开发者

Prevent jQuery animation queue

开发者 https://www.devze.com 2022-12-18 13:07 出处:网络
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:

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

精彩评论

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