简体   繁体   English

重叠式CSS无法正常工作

[英]Overlay css not working

i'm putting an overlay so that the elements on my page are disabled. 我要放置一个叠加层,以便页面上的元素被禁用。 On my page there are two elements. 在我的页面上有两个元素。 One is an anchor tag and another is a file upload input control. 一个是anchor标记,另一个是file upload输入控件。 File upload control is invisible by default and is triggered on clicking the anchor tag. 默认情况下,文件上传控件是不可见的,并且在单击锚标记后会触发。 The problem is i have an overlay over these controls but its not working for the invisible file upload control. 问题是我在这些控件上有一个叠加层,但对于不可见的文件上载控件不起作用。 During overlay if i click on the file upload area its triggered.Here is jsfiddle Try clicking the PR text in jsfiddle, it shouldn't work due to overlay but is clickable 在覆盖期间,如果我单击文件上传区域,则触发它。这里是jsfiddle尝试单击jsfiddle中的PR文本,由于覆盖而无法正常工作,但可以单击

Here is the html code 这是HTML代码

<div class="ast">
<div class="notEdit-overlay"></div>
<a id="uploadQrCode" href="#" style="cursor:pointer;">Upload QR Code</a>
P<input id="qrCodeFileUpload" type="file" class="hideQRUpload" />R
</div>

Jquery code jQuery代码

    $('#uploadQrCode').click(function(){
    $('#qrCodeFileUpload').click();
});

And here is the css 这是CSS

    .hideQRUpload
{
    position:absolute;
    opacity:0;
    width:0px;
    height:0px;
}
.notEdit-overlay
{
    width: 1080px;
    height: 99%;
    left: 0px;
    background: red;
    position: absolute;
    opacity: 0;
    filter: alpha(opacity=0);
}
.ast{
    position: relative;
}

Change css for .notEdit-overlay like this 像这样将CSS更改为.notEdit-overlay

.notEdit-overlay
{
 width: 1080px;
 height: 99%;
 left: 0px;
 background: none;
 position: absolute;
 opacity: 0;
 filter: alpha(opacity=0);
 z-index: 1;
}

should use z-index. 应该使用z-index。

http://jsfiddle.net/T5E8D/3/ http://jsfiddle.net/T5E8D/3/

尝试添加pointer-events: none上载字段pointer-events: none包含pointer-events: nonehttp://jsfiddle.net/T5E8D/2/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM