仅当鼠标停留在元素上时,jQuery才会激活鼠标悬停函数
I would like to activate a .mouseover
function only if the mouse lays down on the "trigger" element for a predetermined duration (e.g. 500 milliseconds).
我想要激活一个.mouseover函数,只有当鼠标在“trigger”元素上放置一个预定的持续时间(例如500毫秒)。
E.g.
如。
$('.featured').mouseover(function () {
$('.feat-txt').fadeOut("fast");
});
Only if the mouse is positioned over the .featured element for at least 500 milliseconds period, the function can start and .feat-txt can FadeOut. A simple mouse over (just a quick movement) on that element doesn't activate the function.
只有当鼠标在. features元素上放置至少500毫秒时,函数才能启动,而.feature -txt可以淡出。在该元素上的简单鼠标(只是一个快速移动)不会激活函数。
Any suggestion on how to do that?
有什么建议吗?
3 个解决方案
#1
6
I have used hover intent in the past - pretty good and does what you're after I think:
我以前用过鼠标悬停的意图——很好,我想我做的是:
http://cherne.net/brian/resources/jquery.hoverIntent.html
http://cherne.net/brian/resources/jquery.hoverIntent.html
更多相关文章
- 动态添加表单元素,将它们存储到MySQL并在将来更改/删除它们
- 3.29 学前端 jquery之操作元素之属性操作
- jQuery循环没有每个和回调函数
- JavaScript函数中的Ruby代码
- 禁用焦点上的锚点()元素上的灰色边框
- 在jQuery中使用部分ID查找元素?(复制)
- jQuery.parseJSON()函数详解
- 使用数字作为javascript对象元素的名称
- 从内部获取函数名称