我在 iFrame 中有一个 Flash 动画。当我尝试隐藏它时,IE10 会保持它显示并与其他内容重叠。
<body style="background-color: #EEE">
Testing IE10
<div id="swfDiv">
<iframe src="swf.html" width="500" height="50"></iframe>
<br />
<button onclick="document.getElementById('swfDiv').style.display='none'">Hide</button>
</div>
<div style="background-color: #DDD">
This try to hide the animation, but it is not working on IE10. <br/> It works fine in others browsers and earlier versions of IE.
</div>
</body>
2013 年 2 月 8 日更新 我在 Safari (5.1.7) 中发现了同样的问题
最佳答案
显然最好的解决方案是将它移出屏幕:
.xhide
{
display: block;
position: absolute;
left:-9999px;
}
我们可以在点击时添加这个类来隐藏它,比如:
document.getElementById('swfDiv').className = "xhide";
关于javascript - IE10/Safari 无法隐藏 iFrame 中的对象/Flash,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14609136/