javascript - timing/waiting in jQuery -


i writting banner rotator , want cycle among few pictures after few seconds. jquery has waiting , calling callback? can see .delay method, doesn't seem have callback function. or maybe should use browser-dependant function? or maybe javascript contains function need? new javascript :-| .

you can use native javascript:

settimeout(function(){ /* stuff */ }, 1000); 

you can have fun mixins:

var timeoutcallback = function() {     this.foo = 5; }  var scheduletimeout = function(obj, delay) {     settimeout(function(){ timeoutcallback.call(obj); }, delay); }  var myobj = { foo: 1, bar: 2 } scheduletimeout(myobj, 1000); // myobj.foo becomes 5 after 1000ms delay 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -