开发者

Prevent jQuery animation queue

I have found a number of answers for the same question in a DIFFERENT context. I'm looking to add '.stop' to the following code to prevent animation queue buildup:

 //Top Mailing List Drop down animat开发者_JAVA百科ion
 $(document).ready(function() {

$('#top_mailing_hidden').hide();

 jQuery('#top_mailing')
   .bind("mouseenter",function(){
  $("#top_mailing_hidden").slideDown('slow');
 }).bind("mouseleave",function(){
  $("#top_mailing_hidden").slideUp('slow');
 });

});


Just need to add it before you start the next animation

$(document).ready(function() {

var top_mailing_hidden = $('#top_mailing_hidden').hide();
$('#top_mailing').bind("mouseenter",function(){
    top_mailing_hidden.stop().slideDown('slow');
}).bind("mouseleave",function(){
    top_mailing_hidden.stop().slideUp('slow');
});

});

You might look in to the hoverintent jQuery plugin though, helps with making things like this not so jerky.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜