Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/88.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用jquery悬停事件_Jquery_Hover_Jquery Hover - Fatal编程技术网

使用jquery悬停事件

使用jquery悬停事件,jquery,hover,jquery-hover,Jquery,Hover,Jquery Hover,我有一个jquery悬停事件,当您将鼠标悬停在元素上时触发。问题是,如果您将鼠标悬停在元素上多次,它会将事件排队,有时会让元素闪烁几分钟,这取决于您将鼠标悬停在元素上的速度和时间。我想停止事件的传播,以便消除此队列 $('.pui-search-item').hover( function() { $(this).find('.pui-actions').show('fade'); }, function(){ $(this).find('.pui-act

我有一个jquery悬停事件,当您将鼠标悬停在元素上时触发。问题是,如果您将鼠标悬停在元素上多次,它会将事件排队,有时会让元素闪烁几分钟,这取决于您将鼠标悬停在元素上的速度和时间。我想停止事件的传播,以便消除此队列

$('.pui-search-item').hover( function() {
        $(this).find('.pui-actions').show('fade');
    }, function(){
        $(this).find('.pui-actions').hide('fade');

    });
我该怎么做呢?我已经尝试了各种传播函数,但没有效果

提前感谢。

在动画之前添加一个
stop(true)
函数调用,以便重置队列。

尝试以下操作:

$('.pui-search-item').hover( function() {
        $(this).find('.pui-actions').stop(true, true).show('fade');
    }, function(){
        $(this).find('.pui-actions').stop(true, true).hide('fade');

    });
以下是有关stop()的更多信息。

请尝试链接

您的实施将更改为:

$('.pui-search-item').hover(function() {
  $(this).find('.pui-actions').stop(true, true).fadeOut();
}, function() {
  $(this).find('.pui-actions').stop(true, true).fadeIn();
});

pui搜索项目是否有列表?Genius-谢谢-现在已修复:$(此项)。查找('.pui操作')。停止(true,true)。显示('fade')@Haraldo记得第二个参数控制它是否跳跃。就我个人而言,我会将其保留为false,以便从当前的不透明度开始显示或隐藏。这比使用hoverIntent插件或设置和间隔更坚实、更平滑吗?@easwee这当然更容易,如果看起来差不多,我会坚持使用它。我从来没有使用过插件。