jQuery 悬停问题 - 鼠标移动时悬停触发
供参考:http://www.favsav.com/-public
您会注意到,如果将鼠标悬停在列表项上,元数据会向上滑动。如果您将鼠标仍然放在顶部,然后向左或向右移动一点,它会再次触发。如果你四处走动,还会发生一些其他愚蠢的事情。
代码非常简单:
$('li.post').hover(function(){
$(this).find('.meta').slideDown('fast');
}, function(){
$(this).find('.meta').slideUp('fast');
})
知道为什么事情会这样吗?
这似乎只发生在 Firefox 中(我在 OSX 上使用 3.5.5)
更新 重新启动 Firefox 后,一切都很好!感谢您的投入!
For reference: http://www.favsav.com/-public
You'll notice that if you hover over a list item, the meta data slides up. If you leave your mouse still on top, and then move a smidgen to the left or right, it triggers again. There's some other silliness going on if you move around
The code is pretty simple:
$('li.post').hover(function(){
$(this).find('.meta').slideDown('fast');
}, function(){
$(this).find('.meta').slideUp('fast');
})
Any idea why things are behaving like this?
This seems to only be happening in Firefox (i'm using 3.5.5 on OSX)
UPDATE After restarting Firefox, all is well! Thanks for the input!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
遗憾的是,我无法在 Google Chrome 3.0.195.33 中重现此行为。对我来说,这似乎可能只是浏览器中渲染/javascript 处理的问题。您使用什么浏览器?代码看起来没问题。
更新: 看看问题是如何通过重新启动 Firefox 解决的,并且它是不可重现的,看起来你的代码是 A-OK。祝你好运!
Unfortunately, I'm not able to reproduce this behavior in Google Chrome 3.0.195.33. To me, it seems that this might just be an issue with the rendering/javascript handling in your browser. What browser are you using? The code looks OK.
UPDATE: Seeing as how the problem was resolved with a reboot of Firefox, and that it was un-reproducible, it seems that your code is A-OK. Good luck!
如果您遇到这种情况,请尝试设置高度和高度。您将鼠标悬停在其上的元素的宽度。
If this does happen to you, try setting a height & width on the element you're hovering over.