jquery去除闪烁
块在 .hover()
上闪烁
这是一个完整示例 - http://jsfiddle.net/xBEjQ/
如何解决这个问题?
UPD:弹出窗口应该在鼠标离开较小的块后被删除 /em> (.image
),而不是 .popup
块。
Block is blinking on .hover()
Here is a full example - http://jsfiddle.net/xBEjQ/
How to fix this?
UPD: popup should be removed after the mouse leaved the smaller block (.image
), not .popup
block.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
对于更新的问题:由于鼠标事件不会发生在较小的元素上(它完全重叠),因此您必须使用第三个
;
像这样:并添加此 CSS(注意比其他
.popup
更高的z-index
):和脚本以匹配:
您可以在这里进行测试。
对于上一个问题:由于弹出窗口位于元素顶部,因此使用
mouseenter
位于触发器上,mouseleave
位于弹出窗口,如下所示:您可以在此处测试。
For updated Question: Since the mouse events won't occur on that smaller element (it's completely overlapped) you'd have to use a third
<div>
like this:And add this CSS (note the higher
z-index
than the other.popup
):and script to match:
You can test it out here.
For previous question: Since the popup is over top of the element, use the
mouseenter
on the trigger,mouseleave
on the popup, like this:You can test it here.
更新了您的 jsfiddle: http://jsfiddle.net/xBEjQ/6/
HTML
<强>jQuery
<强>CSS
Updated your jsfiddle: http://jsfiddle.net/xBEjQ/6/
HTML
jQuery
CSS
鼠标悬停时显示弹出窗口
隐藏弹出窗口鼠标移出时的弹出窗口
http://jsfiddle.net/generalhenry/WkH6q /
show the popup on mouseover
hide the popup on mouseout of the popover
http://jsfiddle.net/generalhenry/WkH6q/
这仅适用于“图像”上方有“弹出窗口”的情况。它闪烁的原因是,一旦“弹出窗口”显示,它就会触发“图像”上的“鼠标悬停”,从而隐藏“弹出窗口”,
只要“弹出窗口”不位于顶部,您的代码就可以正常工作的“图像”。
This only applies if you have the "popup" over top of the "image". The reason it's blinking is because as soon as the "popup" shows it's triggering the "mouseout" on the "image" and thus hiding the "popup"
Your code will work fine as long as the "popup" isn't positioned over top of the "image".