Created
November 13, 2011 19:45
-
-
Save scruffyfox/1362570 to your computer and use it in GitHub Desktop.
JQuery Delay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//******************************************************************** | |
// | |
// jQuery delay created by Callum Taylor | |
// v 0.1 | |
// This simple function is to emulate a javascript setTimeout but | |
// in a jQuery way. This is not the same as the standard effects delay | |
// where you can only use delay AFTER an effect, this plugin can | |
// be used on its own to delay a function from executing | |
// | |
// Usage: | |
// @delay: time in Milliseconds | |
// @Callback: nested function or funtion name | |
// $.delay(delay, callback); | |
// | |
//******************************************************************** | |
$.delay = function(timeout, callback) | |
{ | |
$('body').append("<a id='jqdelay'></a>"); | |
$('#jqdelay').animate( | |
{ | |
"delay": 1 | |
}, timeout, callback); | |
$('#jqdelay').remove(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment