当光标悬停在div上时,我会对它进行动画处理。
这就是mouseover (jquery)。
现在的问题是,该div上的文本会中断动画,因为光标不再与该div直接接触。
我该如何解决这个问题呢?
//navi is the div.
$("#navi").mouseover(function(){
$("#navi").stop();
$("#navi").animate({width:'200px'},{queue: false,easing:"easeOutBounce",duration:1200});
});相同的代码在text-div中。
你可以在这里测试一下http://jsfiddle.net/rSQaP/17/
只需在红色div处于动画状态时尝试鼠标经过和鼠标移出即可。动画将受到蓝色div上鼠标悬停动作的影响。
发布于 2013-03-24 18:42:15
$("#navi").mouseover(function(){
$("#navi").stop().animate({width:'200px'},{queue: false,easing:"easeOutBounce",duration:1200});
while($("#navi").is(":animated")){
$("#navi").off('click').off('mouseover');
//you can add all the events you want to ignore
//if it doesn't work, use unbind instead of off
};
//re-enable these events
$("#navi").on('click').on('mouseover'); //here you could use bind instead of on
});https://stackoverflow.com/questions/15597422
复制相似问题