Reputation: 1009
I have a little query, when I click on the image to toggle the navigation multiple times really fastly it builds up a que of clicks that go on by themselves, its really annoying and I can't figure out how to stop it as the jquery .stop isn't working.
here is the url
here is my code
$('img').toggle(function() {
$('ul').fadeIn("slow");
},
function() {
$('ul').fadeOut("slow");
});
Upvotes: 1
Views: 784
Reputation: 262939
You can use the stop() method to clear the animation queue and stop the current effect before queuing a new one:
$('img').toggle(function() {
$('ul').stop(true, true).fadeIn("slow");
}, function() {
$('ul').stop(true, true).fadeOut("slow");
});
Upvotes: 3