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! " );   }); }); 

http://api.jquery.com/promise/


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -