且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

单击放置在IE中的图像上的div

更新时间:2023-09-11 20:57:28

这是一个黑客:在内部div中添加一个类似O的CHAR,然后给它一个巨大的字体大小(取决于你想要跨越的区域):

Here's a hack: add an CHAR like "O" to the inner div, and then give it an enormous font size(depends on the area you want to span over):

#divInner { /* ... */; font-size: 1000px; color: transparent; }

(我认为也设置为溢出:隐藏。)

(Also set "overflow: hidden" I think.)

IE喜欢容器中有东西可以让点击影响。如果它只是完全为空,它会忽略点击。

IE likes there to be something there in the container for the click to affect. If it's just completely empty, it ignores clicks.

小提琴: https://jsfiddle.net/cbnk8wrk/1/ (在IE中观看!)

a fiddle: https://jsfiddle.net/cbnk8wrk/1/ (watch in IE!)