本篇文章给大家带来的内容是关于html实现窗口大小变化时页面刷新(代码),有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。
<!DOCTYPEhtml>
<html>
<head>
<metacharset="UTF-8">
<metaname="viewport"content="width=device-width,initial-scale=1.0">
<metahttp-equiv="X-UA-Compatible"content="ie=edge">
<metaname="viewport"content="width=device-width,initial-scale=1.0,user-scalable=no">
<title>Document</title>
<script>
//窗口大小变化时候,进行刷新页面操作,防止样式混乱
varx=window.innerWidth;
functionresizeFresh(){
if(x!=window.innerWidth)
location.reload();
}
</script>
</head>
<bodyonresize="resizeFresh()">
<divstyle="min-width:800px;height:400px;background-color:brown;">
</div>
刷新页面
</body>
</html>


本文转载自中文网


本文转载自中文网
如需转载,请注明文章出处和来源网址:http://www.divcss5.com/html5/h54832.shtml