javascript - pointer-events none 在 IE 中的行为不符合预期

标签 javascript jquery html css internet-explorer

我遇到了 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>

最佳答案

resolved here : stackoverflow

希望这有帮助:)

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);
  }
});

关于javascript - pointer-events none 在 IE 中的行为不符合预期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42132609/

相关文章:

javascript - jQuery .attr 不工作

javascript - 从父脚本访问预加载的图像以在子脚本中使用。如何?

javascript - D3 选择具有特定类别或类别组合的所有元素

javascript - 将类应用于 javascript 数据表中的每一行

jQuery - 为什么 $ ('form' ).get(0).submit() 不触发附加的提交处理程序?

javascript - jQuery 单击事件在尝试忽略某些子项时会出现问题

javascript - 我应该如何让这个番茄计时器更有用?

php - html 表单和 php 从 Mysql 填充

javascript - 用字符串中包含的一些 HTML 替换 HTML 元素

html - 一个 HTML 元素可以有多个 id 吗?