iframe放大显示,如何让iFrame在点击按钮时全屏显示?
I would to make the iFrame to appear on fullscreen with a button click using JavaScript.
解決方案
You will have to do two things: make the window fullscreen, and then the to fill up the whole size.
You can make it go fullscreen with JS such as in this SO answer.
Then, to make it full size, just add a few styles, like below. What this JS script does is add a class with those styles to the .
JS
document.getElementsByTagName("iframe")[0].className = "fullScreen";
CSS
body, html {
height: 100%;
margin: 0;
}
.fullScreen {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
*partially working because JSFiddle doesn't allow the fullscreen method because it deems it unsafe. But it should work for you.
總結
以上是生活随笔為你收集整理的iframe放大显示,如何让iFrame在点击按钮时全屏显示?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 基金投资亏损回本方法 选择合适位置进行加
- 下一篇: go int 最大值_Dig101 -