Reputation: 7734
So, i need to have some universal timeout function for my script. I will need to use this many times and i want to universalize it, so i try with that, but smthg is wrong, can u help me?
$.fn.timeout = function(action, time){
setTimeout(function(){
action;
}, time);
return this;
}
and call:
.timeout(
settings_container.addClass('slide_down'), 200
);
Thx.
Upvotes: 1
Views: 181
Reputation: 1907
Without having to attach to jquery:
GlobalObject.SpcificTimeOuttFnName = function()
{
setTimout
(
// Perform some generic action
function()
{
$('.settings-container').addClass("slide-down");
},
200
);
}
Upvotes: 0
Reputation: 15012
You aren't executing the action function,
change:
action;
to:
action();
Upvotes: 2