OnMouseOver DIV 麻烦
好的,我的基本问题如下。我有一个图像,导致页面上的其他所有内容都无法使用带有 z 索引的空白 div。这是在图像的鼠标悬停事件期间。接下来,代码将在我希望能够单击或鼠标悬停的 div 上设置 z-index。另外,我将这些图像包装在一个用于鼠标悬停事件的 div 中,以隐藏我不想显示的图像。
但是,当鼠标悬停在 div 内的图像或文本上时,会触发 mouseout 事件。我研究过事件冒泡,但似乎并不是正在发生的事情。有没有办法通过 mouseover 事件关闭 div 内部对象的 mouseout 事件?
长话短说,我需要使鼠标移出事件不在嵌套项目上触发。
提前致谢。
Ok so my basic problem is as follows. I have an image that causes everything else on the page disable using a blank div with a z-index. This is during a mouseover event of the image. Next the code goes into setting the z-index on the div that I want to be able to click or mouseover. Also I wrapping these images in a div that is used for a mouseout event to hide the images I do not want to show.
However when mousing over the images or text inside the div it causes the mouseout event to trigger. I have looked into event bubbling but it does not seem to be what is happening. Is there a way to turn off the mouseout event to object inside of the div with the mouseover event?
Long story short I need to make a mouseout event not trigger on nested items.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
除了使用 mouseout 之外,您还可以这样做:
该方法应该很清楚,如果鼠标位于空白 div 上,则它必须位于包装器 div 之外。
Instead of using mouseout you may go this way:
The approach should be clear, if the mouse is over the blank div it must be outside the wrapper-div.