有没有什么办法来检测鼠标指针多少秒保持一个HTML元素?jQuery的检测鼠标多少秒停留在元素
我想找回鼠标多少秒停留在元素放少许延迟一个回调事件......如果可能:)
我与一个简单的()循环检测尝试通过计数器:
var time_over ;
$('.bean-active').live('mouseover',function(){
id_tag = $(this).attr("id");
for(time_over = 1;time_over <= 3000;time_over ++){
if(time_over == 3000){
$('.bean-bubble,.bean-bubble img').hide();
$('#bean-bubble-'+id_tag+',#bean-bubble-'+id_tag+' img').show();
}
}
});
的问题是,它不工作:(
也是我想结合mouseLeave事件,脚本逻辑应该是:
while (mouseover element count how many time it stays over)
if (time == n)
{ do somenthing }
if (mouseleave from element earlier then time)
{ do somenthing different }
尝试将鼠标悬停意向(google一下) – mtahmed
使用,现在:),但似乎超时不为我的作品:P。 – sbaaaang
$( '豆处于激活状态 '),住(' 鼠标悬停',函数() {(this).hoverIntent({){function(){ id_tag = $(this).attr(“id”); $(this).fadeTo(100,0.5).fadeTo(200,1 ); $( '豆气泡,.bean气泡IMG ')隐藏(); $(' #豆气泡 - '+ id_tag +',#豆气泡 - '+ id_tag +' IMG')。显示(); }, 超时:900, 出:函数(){ 返回假; } }); $(this).trigger('mouseover'); }); – sbaaaang