我遇到了 pointer-events:none
css 的问题。我正在尝试禁用 组合框
。
现在,此 CSS 在 Chrome 和 Firefox 中完美运行,但在 IE 中只能部分运行。
虽然组合框在 IE 中仍然被禁用,但我可以单击组合框并显示下拉列表,这不应该显示。请指导我是否可以使用一些补丁。
代码如下:
.pointer-events {
pointer-events: none;
}
<select id="originPlaceId" name="originPlaceId" class="pointer-events" size="1" style="width:99%;">
<option value="Tiger">Tiger</option>
<option value="Lion">Lion</option>
</select>
最佳答案
希望这有帮助:)
http://www.vinylfox.com/forwarding-mouse-events-through-layers/
您也可以尝试 javascript 解决方案:
function passThrough(e) {
$(".box").each(function() {
// check if clicked point (taken from event) is inside element
var mouseX = e.pageX;
var mouseY = e.pageY;
var offset = $(this).offset();
var width = $(this).width();
var height = $(this).height();
if (mouseX > offset.left && mouseX < offset.left+width && mouseY > offset.top && mouseY < offset.top+height)
$(this).click(); // force click event
});
}
$("#shield").click(passThrough);
var dthen = new Date();
var doPassThrough = true;
$('input').click(function(){
doPassThrough = !doPassThrough;
if (doPassThrough){
$("#shield").click(passThrough);
} else {
$('#shield').unbind('click', passThrough);
}
});
关于javascript - pointer-events none 在 IE 中的行为不符合预期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42132609/