当元素被覆盖时取消鼠标事件 [英] cancelling mouseout event when element is overlaid
问题描述
希望这个JSFiddle应该比我的话更好地说明问题:
Hopefully this JSFiddle should illustrate the issue better than my words:
我在图像地图上显示了一个绝对定位的H4作为标签当地图徘徊时。然而,当鼠标指针移动到H4上时,图像映射将触发鼠标,这会使H4再次被隐藏。
I'm displaying an absolutely positioned H4 as a label over an image map when the map is hovered. However, when the mouse pointer is moved over the H4, the image map fires a mouseout, which causes the H4 to be hidden again.
我该如何防止这种情况?我希望鼠标在图像地图上可以看到标签,而不管它是否也在标签上。
How can I prevent this? I want the label visible while the mouse is over the image map, regardless of whether it's also over the label.
推荐答案
你可以使用放置在图像上方的透明图像/图层(使用您的地图)欺骗。
You could 'cheat' using a transparent image/layer (using your map) which is placed on top of your image.
它使用图像地图坐标。
这篇关于当元素被覆盖时取消鼠标事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!