iframe平铺到浏览器

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="jquery-1.9.1.min.js"></script>
<style>
*{
margin: 0;padding:0
}
html,body{
height:100%;
width:100%;
}
iframe{
background: red;
position: fixed;
width:100%;
height:100%;
left:0;
top:0
}
</style>
</head>
<body>
<iframe src="http://bsdp.cmvideo.cn/" marginheight="0" marginwidth="0" id="iframe" frameborder="0" width="100%" height="100%" ></iframe>
<script>
$("#iframe").attr("width",window.innerWidth+"px").attr("height",window.innerHeight+"px");
window.onresize=function(){
$("#iframe").attr("width",window.innerWidth+"px").attr("height",window.innerHeight+"px");
}
</script>
</body>
</html>






























<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="jquery-1.9.1.min.js"></script>
<style>
*{
margin: 0;padding:0
}
html,body{
height:100%;
width:100%;
}
iframe{
background: red;
position: fixed;
width:100%;
height:100%;
left:0;
top:0
}
</style>
</head>
<body>
<iframe src="http://bsdp.cmvideo.cn/" marginheight="0" marginwidth="0" id="iframe" frameborder="0" width="100%" height="100%" ></iframe>
<script>
$("#iframe").attr("width",window.innerWidth+"px").attr("height",window.innerHeight+"px");
window.onresize=function(){
$("#iframe").attr("width",window.innerWidth+"px").attr("height",window.innerHeight+"px");
}
</script>
</body>
</html>






































































posted @ 2018-04-02 17:33  刘浩2561179983  阅读(399)  评论(0编辑  收藏  举报