Note that as of jQuery 1.4.3, the type of event that is reported when using 'hover' with .delegate() or .live() is no longer mouseover/mouseout (as it ought to be). Now it will be mouseenter/mouseleave, which just seems silly since they're non-bubbling events.
$shortcut.delegate("a","hover",function(event){
var type = event.type;
if(type == "mouseenter"){ //移入
}else{//mouseleave 移出
}
});
本文深入分析了jQuery 1.4.3版本中,使用delegate()或live()方法处理hover事件时,事件类型从mouseover/mouseout转变为mouseenter/mouseleave的问题。通过实例演示如何调整代码逻辑,确保在不同事件触发时实现预期功能。
1万+

被折叠的 条评论
为什么被折叠?



