I did kind of the same think for an extension on to of animation() 
function. Funny thing it happened on the time two people to get almost 
the same solution.


Lincoln Cooper wrote:
> I've written a small plug-in work-around for stopping animation - not 
> very pretty, but does the job while waiting for the 'official' version 
> in jQuery 1.2.
>
> I Would like some feedback (not too harsh please!).
>
> The plug-in was inspired by the original 'easing' plug-in by George 
> Smith and goes like this:
>
> // Modify fx function by converting first to a String
> jQuery.fx = String(jQuery.fx).replace(RegExp("13\\);"), "13);if 
> (options.handle){ eval('window.'+options.handle+'= z.timer');}");
>    
> // make it a Function again
> jQuery.fx = Function( "elem", "options", "prop", jQuery.fx.substring 
> (jQuery.fx.indexOf('{')+1, jQuery.fx.lastIndexOf('}')));
>
>
> // Clear the Queue
> $.fn.clearQueue = function(type) {
>     return this.each(function(){
>         type = type || "fx";
>         if(this.queue && this.queue[type]) {
>             this.queue[type].length = 0;
>         }
>     });
> };
>
>
> Then to use it you do something like this:
>
>
> <script type="text/javascript">
> window.aHandle=null;
>
> function startAnimate() {
>   $('#abc').animate({left:500}, { complete:function(){},
>                                   duration:5000,
>                                   easing:true,
>                                   handle:'aHandle'}, 'easein');
>  
> }
> function stopAnimate() {
>   window.clearInterval(window.aHandle);
>   $('#abc').clearQueue();
> }
> </script>
>
>
> Lincoln.
> ------------------------------------------------------------------------
>
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>   


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to