只有当鼠标放在元素上时,jQuery才会激活鼠标悬停功能

Cyb*_*mac 5 jquery duration mouseover delay eventtrigger

我想.mouseover仅在鼠标在"触发"元素上放置预定持续时间(例如500毫秒)时才激活功能.

例如

$('.featured').mouseover(function () {
      $('.feat-txt').fadeOut("fast");
    });
Run Code Online (Sandbox Code Playgroud)

仅当鼠标位于.featured元素上至少500毫秒时,该函数才能启动,而.feat-txt可以是FadeOut.在该元素上使用简单的鼠标(仅快速移动)不会激活该功能.

有关如何做到这一点的任何建议?

Pau*_*aul 6

我过去曾经使用过悬浮意图 - 相当不错,并且按照我的想法做你想做的事情:

http://cherne.net/brian/resources/jquery.hoverIntent.html