user877559
user877559

Reputation:

Does slideToggle have some kind of bug?

I made a slideToggle panel using jquery here you can see. But I guess I have found a bug. When you took and leave your mouse on it(on the div that has hover function) for a few times, the bug appears.

How can I fix this bug ?

thanks..

EDIT I have just found this:

http://stackoverflow.com/questions/5266683/slidedown-and-slideup-looping-bug-in-firefox

That's what I was looking for.

Thanks..

Upvotes: 1

Views: 574

Answers (2)

Ahmad Baktash Hayeri
Ahmad Baktash Hayeri

Reputation: 5880

What you are referring to is NOT any sort of a bug, not specific to any browser either.

In fact when you register a handler for a particular event, the handler by itself won't be capable of handling immediate firing of the event and therefore you'll end up with queuing of the fired events.

To stop such behavior, simply use jQuery's is() method with the filter :animated and return false in the handler.

if($('#will_slideDown').is(':animated')){
        return false;
}

JSFiddle

Upvotes: 0

David Wick
David Wick

Reputation: 7105

add the .stop() method to prevent the animation from queuing. i.e. $("#will_slideDown").stop(true, true).slideToggle("normal");

Upvotes: 1

Related Questions