Skip to content

Instantly share code, notes, and snippets.

@Sysetup
Created July 19, 2016 23:23
Show Gist options
  • Save Sysetup/37a264c7d859b35d5de692e87ae84e7a to your computer and use it in GitHub Desktop.
Save Sysetup/37a264c7d859b35d5de692e87ae84e7a to your computer and use it in GitHub Desktop.
Prevent JQuery Animation Queue
//stop() is the key.
$( "#hoverme-stop-2" ).hover(function() {
$( this ).find( "img" ).stop( true, true ).fadeOut();
}, function() {
$( this ).find( "img" ).stop( true, true ).fadeIn();
});
//Other example:
$(document).ready(function() {
$('ul.anim_queue_example2 a')
.hover(function() {
$(this).stop().animate({ left: 20 }, 'fast');
}, function() {
$(this).stop().animate({ left: 0 }, 'fast');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment