我有一个文档查看器,其中.less文件具有:
div.document-previewer-container {
//height: 400px;
//width: 300px;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
//padding: 5px 2px;
> div.document-preview {
height: 88%;
//width: 100%;
position: relative;
.document-container, .text-container, video, iframe, pre {
height: 100%;
width: 100%;
position: relative;
}
.document-container > img {
max-height: 100%;
max-width: 100%;
}
.text-container pre {
margin: 0;
padding: 0;
}
.doc-overlay {
width: 95%;
height: 95%;
position: absolute;
cursor: pointer;
top: 0;
p {
padding: 2px;
}
}
}
}我的html是
<div class="document-previewer-container">
<div class="document-preview">
<h3 ng-click="vm.openPDF()">yu</h3> <----- THIS CLICK IS WORKING
<div class="document-container">
<!-- PDF show in iframe -->
</div>
<div class="doc-overlay" ng-click="vm.openPDF()"> <---- THIS CLICK ISN'T becuse if is hidden by iframe
<!-- any content is shown on the top of PDF file in chrome only, not in IE -->
</div>
</div>
</div>
</div>我的点击事件是在标记上工作的,但是当使用css类‘’点击div时就不行了。
如何处理?
我正在为IE11使用Foxit插件
Update1 我发现了this的问题,我认为这个问题发生在我身上。iframe是重叠的
.doc-overlay,因此单击不起作用。对此有任何建议请
发布于 2017-03-30 07:41:00
实际上,这是一个CSS问题。您已经使用了SCSS格式,这就是为什么DOM无法找到类“”的原因。
你可以使用这个CSS,它会工作的很好。
div.document-previewer-container {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
div.document-previewer-container> div.document-preview {
height: 88%;
position: relative;
}
div.document-previewer-container> div.document-preview .document-container, .text-container, video, iframe, pre {
height: 100%;
width: 100%;
position: relative;
}
div.document-previewer-container> div.document-preview .document-container > img {
max-height: 100%;
max-width: 100%;
}
div.document-previewer-container> div.document-preview .text-container pre {
margin: 0;
padding: 0;
}
div.document-previewer-container> div.document-preview .doc-overlay {
width: 95%;
height: 95%;
position: absolute;
cursor: pointer;
top: 0;
}
div.document-previewer-container> div.document-preview .doc-overlay p {
padding: 2px;
}
https://stackoverflow.com/questions/43110506
复制相似问题