navigation - When navigating on a site, how can i make animations complete fully before browser jumps pages -
i want use animate.css in webpage, on navigation menu. e.g menu flies out of screen navigating. main problem is: how can delay page load i'm clicking until animation complete. right animation cut off because next page loads.
$(document).ready(function(){ $('#list').click(function(){ $(this).addclass('animated shake'); window.settimeout( function(){ $('#list').removeclass('animated shake'); }, 1000); }); });
there promise() in jquery > 1.6 . can queue request of going further waiting promise().
$("button").on( "click", function() { $("p").append( "started..."); $("div").each(function( ) { $( ).fadein().fadeout( 1000 * (i+1) ); }); $( "div" ).promise().done(function() { $( "p" ).append( " finished! " ); }); });
Comments
Post a Comment