#values43011009create {
pointer-events: none;
background-color: #f9f9f9;
}此代码在IE 10中不起作用,但在IE 11及更高版本中运行良好。
我也需要一个较低版本的IE的修复。非常感谢您的帮助。
发布于 2018-09-25 17:57:22
另一种解决方案是在链接顶部添加一个Psuedo ::after元素,作为防止被点击的封面:
.yourlink {
position: relative;
z-index: -1
}
.yourlink::after {
content: ' ';
background-color: #fff;
position: absolute;
height: 100%;
top: 0;
left: 0;
opacity: 0;
width: 100%;
z-index: 250;
}如果你想只在IE浏览器上这样做,而不是Firefox或Chrome,那么你可以将所有这些都封装在一个只针对IE的媒体查询中:
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
.yourlink {
position: relative;
z-index: -1
}
.yourlink::after {
content: ' ';
background-color: #fff;
position: absolute;
height: 100%;
top: 0;
left: 0;
opacity: 0;
width: 100%;
z-index: 250;
}
}下面是该解决方案的一个示例:https://jsfiddle.net/Ly06krt3/23/
发布于 2018-09-26 14:20:32
为了防止click事件,您可以参考下面的示例。
var handler = function(e)
{
e = e || window.event;
var target = e.target || e.srcElement;
if (target.tagName.toLowerCase() === 'a')
{
if (!e.preventDefault)
{//IE quirks
e.returnValue = false;
e.cancelBubble = true;
}
e.preventDefault();
e.stopPropagation();
}
};
if (window.addEventListener)
window.addEventListener('click', handler, false);
else
window.attachEvent('onclick', handler);
参考资料:
https://stackoverflow.com/questions/52495116
复制相似问题