我有一个时间轴,上面有小图钉,当鼠标悬停在上面时,它们会向上或向下滑动,然后显示标题。当鼠标离开时,标题应该消失并且图钉回到原位。这个功能可以实现,但是使用的代码如果鼠标移动得太快,就无法检测到鼠标离开。如何解决这个问题?
顺便说一下,我之所以使用mouse enter/leave,是因为我认为需要在文档加载后动态添加元素。
顺便说一下,我之所以使用mouse enter/leave,是因为我认为需要在文档加载后动态添加元素。
$('#about-me .progress-bar .progress .notes li.personal').live('mouseenter',function(){
$(this).animate({
top:25
}, 200, function(){
$(this).find('.caption').stop(true, true).fadeIn(200);
});
}).live('mouseleave',function(){
$(this).find('.caption').stop(true, true).delay(200).fadeOut(200,function(){
$(this).parents('li').animate({
top:30
},200);
});
});
alert('test')
替换mouseleave函数,这样根本不会触发吗? - Stuart Burrows