hi group,

I use the pause-plugin (http://blog.mythin.net/projects/jquery.php) to
delay an slidedown-effect in my navigation if the user mouseovers a
link. I have slightly modified it to get it to work (changing line 29
from
$.dequeue(self)
to
$(self).dequeue()

So this works fine:

$('#navigation>ul>li>a').mouseover(
        function(){
                $(this).parent('li').children('ul')
                .pause()
                .slideDown('slow');
                return false;
        }
   );

but - I want to stop the timeout and ignore the slidedown if the user
mouseouts the link before the animation begins.

I thought that using the "unpause" function from the plugin like this

 $('#navigation>ul>li>a').mouseout(
        function(){
                $(this).parent('li').children('ul')
                .unpause();
        }
   );

would do the trick, but it doesn't; the animation will start after the
delay.
Is there a way to "kill" the timeout and the associated function?

here is my modified plugin-code:

$.fn.pause = function(milli,type) {
        milli = milli || 1000;
        type = type || "fx";
        return this.queue(type,function(){
                var self = this;
                setTimeout(function(){
                        $(self).dequeue();
                },milli);
        });
};

$.fn.clearQueue = $.fn.unpause = function(type) {
        return this.each(function(){
                type = type || "fx";
                if(this.queue && this.queue[type]) {
                        this.queue[type].length = 0;
                }
        });
};

thanks
Tom

Reply via email to