On Dec 16, 2009, at 6:42 AM, Tobias Hoffmann wrote: > Hi, > > On Wed, Dec 16, 2009 at 11:04 AM, jez9999 <jez9...@gmail.com> wrote: > It rather surprised me that one of the things I had to turn to a > plugin for was a timer. It seems like the kind of thing that would > frequently be useful to have, abstracted to a nice jQuery interface, > rather than using directly the rather ugly setTimeout function in > Javascript. Why not implement a timer interface in the jQuery core? > > Well, there is some timer support in jQuery: > jQuery.animate(..) > for repetitive tasks, which also greatly simplifies the attribute- > interpolation. > Note that you can supply a step-callback: > jQuery.animate({},{step:function() {...}}) > > animate solves the chaining problem, too: > $.animate(...task1...).animate(...task2...); > > Though, the building-blocks for chaining are also exposed in the API > as > $.queue() and $.dequeue()
Additionally, in jQuery 1.4 there will be a .delay() method: // Based off of the plugin by Clint Helfers, with permission. // http://blindsignals.com/index.php/2009/07/jquery-delay/ delay: function( time, type ) { time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; type = type || "fx"; return this.queue( type, function() { var elem = this; setTimeout(function() { jQuery.dequeue( elem, type ); }, time ); }); }, --Karl ____________ Karl Swedberg www.englishrules.com www.learningjquery.com -- You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-...@googlegroups.com. To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.