Safari / Chrome中的MouseOver MouseOut问题 [英] MouseOver MouseOut issue in Safari/Chrome
问题描述
我创建了演示jsFiddle 。只要让div在你的鼠标下摆动,在Firefox中工作正常,而不是在Chrome或safari中 - 还没有在ie中测试。我倾向于这个解决方案。 ..基本上使用这个滚动我自己的mouseenter和mouseleave事件:
if(mouseX> divLeft&& mouseX< divRop&&
mouseY> divTop&&& mouseY< divBottom){
// mouse is inside div
}
我说mouseenter并离开,因为此方法不会冒泡
我想知道是否有其他人对此有过想法......我有一种感觉,它有一个简单的方法,但迄今为止,谷歌并没有把任何东西变成什么。
https://bugs.webkit.org /show_bug.cgi?id=4117
您可能会发现这个错误很有趣。
This is a strange one, I'm shocked I've never noticed it before. It works like this, if your mouse is still and a div programmatically moves underneath your mouse, a mouseover event will not be trigged in chrome/safari - same goes for mouseout. Of course, if you move your mouse slightly once the div has moved underneath your mouse it will work as expected.
I created a demo on jsFiddle. Just let the div oscillate under your mouse, works fine in firefox, not in chrome or safari - have yet to test in ie.
I'm leaning toward this solution... basically rolling my own mouseenter and mouseleave events using this:
if (mouseX > divLeft && mouseX < divRight &&
mouseY > divTop && mouseY < divBottom){
// mouse is inside div
}
i say mouseenter and leave because this method would have no bubbling
I was wondering if anyone else had thoughts about this... I have a feeling there is an easy way around it, but so far google hasn't turned anything up.
https://bugs.webkit.org/show_bug.cgi?id=4117
You might find this bug interesting.
这篇关于Safari / Chrome中的MouseOver MouseOut问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!