2015-04-03 85 views
0

我需要一个嵌入式pdf(我试过嵌入和iframe),在它上面有一个人们可以使用的画布(透明)。嵌入式pdf在Opera浏览器中始终处于顶端

在Opera中,嵌入式pdf始终位于顶部。

http://plnkr.co/edit/c1LlRiw2eLiZsp2VAmvb?p=preview

HTML:

<div class="background"> 
    <iframe src="http://mozilla.github.io/pdf.js/examples/learning/helloworld.pdf"></iframe> 
</div> 
<div class="canvas-container"> 
    <canvas width="400" height="400"></canvas> 
</div> 

CSS:

.background, .canvas-container 
{ 
    width: 400px; 
    position: absolute; 
    top: 0; left: 0; 
} 

.background { 
    height: 300px; 
    background-color: #367889; 
    border: 1px solid red; 
    z-index: 1; 
} 

.canvas-container { 
    height: 400px; 
    border: 1px dotted blue; 
    z-index: 2; 
} 

的Javascript:

document.addEventListener("DOMContentLoaded", function() { 
    var ctx = document.getElementsByTagName('canvas')[0].getContext("2d"); 
    ctx.moveTo(0, 0); 
    ctx.lineTo(400, 400); 
    ctx.stroke(); 
}); 

帮我计算器,你是我唯一的希望。

回答

0

看起来像一个非常相关的问题:z-index does not work in Internet Explorer with pdf in iframe

我不知道歌剧,但我可以用IE10您的问题看。看起来具体到PDF,虽然,因为这一小段代码的工作整齐:

<!DOCTYPE html> 
 
<html> 
 

 
<body> 
 
    <div> 
 
    <iframe src="http://www.w3schools.com" style="position: absolute;"> 
 
     <p>Your browser does not support iframes.</p> 
 
    </iframe> 
 
    <div style="height: 300px; width: 200px; background-color:black; position: absolute;"> 
 
    </div> 
 
    </div> 
 
</body> 
 

 
</html>

+0

谢谢,我会尝试很快测试它(我现在pdfjs去了,因为这当然工作它在画布元素上呈现pdf)。 – pambuk 2015-04-10 17:14:06