简体   繁体   English

如何停止jQuery悬停泛滥?

[英]How do I stop jQuery hover flood?

I have a problem with my "menu" items that have an image, and by hovering them, jQuery brings out a text and a description for that image. 我的带有图像的"menu"项有问题,通过将它们悬停,jQuery给出了该图像的文本和描述。 However, I could not find any way to block or stop this effect from flooding. 但是,我找不到任何阻止或阻止这种效果泛滥的方法。

See the example , from this try moving your cursor around the four boxes, fast, you will see that they kind of queue, and I don't really want that to happen. 请参见示例 ,从这个尝试中,快速地将光标移到四个框上,您会看到它们有点排队,我真的不希望这种情况发生。

This is my jQuery code: 这是我的jQuery代码:

$(document).ready(function() {  
    $("[rel='tooltip']").tooltip();    
    if($("#editor").val()!="1")
    {
        $('.thumbnail').hover(
            function(){
              $(this).find('.caption').fadeIn(450)
         },
         function(){
               $(this).find('.caption').fadeOut(800)
         }
     }); 
});

Ways to stop this? 阻止这种情况的方法?

Try adding .stop() ( jQuery API reference ) to your selector. 尝试将.stop()jQuery API参考 )添加到选择器中。 It will cancel an ongoing animation 它将取消正在进行的动画

$(this).find('.caption').stop().fadeIn(450)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM