我有一个关于pointer-events:none css的问题。我正在尝试禁用combo box。现在,这个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>
发布于 2017-02-09 17:26:22
希望这能有所帮助:)
http://www.vinylfox.com/forwarding-mouse-events-through-layers/
您也可以尝试javascript解决方案:
http://jsbin.com/uhuto
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);
}
});发布于 2017-02-09 17:29:18
当你在internet explorer中时你可以使用插件:pointer events polyfill
https://stackoverflow.com/questions/42132609
复制相似问题