将透明度设置为模态弹出窗口内的iFrame

时间:2012-07-26 09:42:27

标签: javascript jquery asp.net css

我在后台显示一个pdf,顶部有一个Popup,其中包含一个iFrame,我想为弹出窗口设置透明度。 它在Chrome浏览器中完美运行,而浏览器的其余部分无法正常工作:(这是Fiddler链接:Click Here

请告诉我如何在所有浏览器中工作。

enter image description here enter image description here

enter image description here

1 个答案:

答案 0 :(得分:-1)

使用一点点javascript和CSS这应该没什么大不了的,虽然iframe需要包装在一个div中,或者其他什么东西:

<div id="iframeContainer">
    <iframe src="http://example.com"></iframe>
</div>

然后在你的javascript中:

// Set the css opacity of the div NOT the iframe:
iframeContainer.style.opacity = 0.5; // the closer to 1 the less transparent
iframeContainer.style.MozOpacity=0.5; // the closer to 1 the less transparent
iframeContainer.style.filters.alpha.opacity=50; // the closer to 100 the less transparent