Click on absolute DIV in Windows mobile firing click on underlying elements

I have a overlay DIV with absolute position width height and width 100%. But when I click on the overlay DIV, click is happening on underlying elements of overlay DIV. Overlay DIV style is like below

 .overlayDIV{
     absolute : absolute;
     height : 100%;
     width : 100%;  
     z-index : 1234;       
 }

How can I prevent that...? This problem exists only in Windows mobile


You can stop the propagation of the event:

JavaScript:

document.getElementById('divId').onclick = function (event) {
    event.preventDefault();
    event.stopPropagation();
}

jQuery:

$('#divId').click(function (event) {
    event.preventDefault();
    event.stopPropagation();
});

Also if you have some handlers on mousedown down the page you need to cancel mousedown from your overlay div (same code but for mousedown handler).


我在IE 10中遇到过这种情况,但不是11,我的解决方案是将以下CSS规则添加到叠加层中:

background:rgba(0,0,0,0);
链接地址: http://www.djcxy.com/p/27432.html

上一篇: CSS calc()函数中的Sass变量

下一篇: 点击Windows mobile中的绝对DIV点击底层元素