Can I use .delay() together with .animate() in jQuery? Can I use .delay() together with .animate() in jQuery? jquery jquery

Can I use .delay() together with .animate() in jQuery?


If you add the stop before the delay it works just fine:

$('.cart_button, .cart_module').hover(function() {    $('.cart_module').stop(true, true).delay(100).animate({top:'39px'}, 400);  },  function() {    $('.cart_module').stop(true, true).animate({top: -cartHeight}, 250);});


Looks like there may have been updates to jQuery in this vein since 2011. In Chrome I can use this sans timeout calls:

$('.thing').hover(function(){    $(".thing").delay(2000).animate({top:'39px'},{duration:500});}


I've always managed this kind of things with the help of core setTimeout and clearTimeout js functions.

Here is an example on jsFiddle

Take a look at jquery.hoverIntent plugin too, it gives you a timeout on hover and out events