jquery中有个很好用的方法hover(),可以解决IE中mouseout的BUG,但如果出现子元素中有绝对定位的元素,当鼠标移至次绝对定位元素时,会自动触发hover()中的第二个方法,也就是相当于mouseout,遇到这种情况,就不能再使用hover()了,而是换成mouseenter和mouseleave,例如:
$('a.move').bind('mouseenter', function (e) {
$(this).children('span.text').toggle();
$(this).animate({right: '5px'}, 'fast');
})
.bind('mouseleave', function (e) {
$(this).children('span.text').toggle();
$(this).animate({right: '0px'}, 'fast');
});
此方法暂未测试,是从老外博客里摘录的,回头有时间再进行测试。
标签:jQuery