简体   繁体   English

如何使指针事件在IE中工作?

[英]How can I make pointer-events work in IE?

My image is in front and the text is at the back. 我的图片在前面,文字在后面。 I want to select the text at the back. 我想选择后面的文字。 This works in chrome and firefox. 这适用于Chrome和Firefox。 How do I make it work in IE also. 我如何也可以在IE中使用它。

<div id="parent-street-view">
    <div id="map_canvas">This is supposed to be visible and selectable</div>
    <img class="overlay-pollution"
    src="http://www.lorempixel.com/400/400" />
</div>​

<style>
@media print {
    .gmnoprint {
        display: none;
    }
}

@media screen {
    .gmnoscreen {
        display: none;
    }
}

#parent-street-view {
    position: relative;
}

#map_canvas {
    position: absolute !important;
    width: 500px;
    height: 400px;
    background-color: rgb(229, 227, 223);
    overflow: hidden;
    -webkit-transform: translateZ(0);
    z-index: 0;
}

#parent-street-view .overlay-pollution {
    width: 500px;
    height: 400px;
    position: absolute;
    z-index: 100;
    opacity: 0.5;
    pointer-events:none;
}​
</style>

http://jsfiddle.net/G5BeU/2/ How do I make this work in IE? http://jsfiddle.net/G5BeU/2/如何在IE中进行这项工作?

1) - The #map_canvas has a z-index value of 0 and the image .overlay-pollution has a z-index value of 100, the problem with this is that the image is actually located above the text so that's why IE doesn't allow selecting the text, to fix this give the #map_canvas higher value so say give #map_canvas - z-index: 101. This will fix the first issue. 1)-#map_canvas的z-index值为0,图像.overlay-pollution的z-index值为100,问题是图像实际上位于文本上方,因此IE不会这样做。不允许选择文本,要解决此问题,请给#map_canvas更高的值,例如说给#map_canvas-z-index:101。这将解决第一个问题。

2) - When you give the #map_canvas a higher value then the background color of #map_canvas will fill the block and the image won't appear so for that just give opacity to #map_canvas background color - background-color: rgb(229, 227, 223, 0.5); 2)-当您为#map_canvas赋予较高的值时,#map_canvas的背景色将填充该块,并且图像不会显示,因此仅给#map_canvas背景色以不透明度-background-color:rgb(229, 227、223、0.5);

Hopefully this should fix the IE issue. 希望这可以解决IE问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM