Created
November 19, 2011 00:37
-
-
Save ded/1378205 to your computer and use it in GitHub Desktop.
ender 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
!function ($) { | |
$.ender({ | |
delay: function (n) { | |
var mock = {} | |
, chain = [] | |
, key | |
, $el = $(this) | |
for (key in $el) { | |
if (isFinite(key)) continue | |
!function (key) { | |
mock[key] = function () { | |
chain.push({key:key,arguments:arguments}) | |
return mock | |
} | |
}(key) | |
} | |
setTimeout(function () { | |
for (var i = 0; i < chain.length; i++) { | |
$el = $el[chain[i].key].apply($el, chain[i].arguments) | |
} | |
}, n) | |
return mock | |
} | |
}, true) | |
}(ender); | |
$('p').css('color', 'red').delay(100).addClass('a').hide().delay(200).fadeIn() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you have way too much time on your hand. this was meant to send to a coworker as a simple proof of concept