小兔网

本篇文章给大家带来的内容是关于html实现窗口大小变化时页面刷新(代码),有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。

<!DOCTYPE html> <html> <head>     <meta charset="UTF-8">     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <meta http-equiv="X-UA-Compatible" content="ie=edge">     <meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=no">     <title>Document</title>     <script>         //窗口大小变化时候,进行刷新页面操作,防止样式混乱             var x=window.innerWidth;         function resizeFresh(){             if(x!=window.innerWidth)                 location.reload();         }     </script> </head> <body onresize="resizeFresh()">     <div style="min-width:800px; height: 400px; background-color: brown;">    </div>     刷新页面 </body> </html>

相关推荐:

html中如何使用js实现长按功能(代码)

html thead标签的作用是什么?html thead标签属性介绍

以上就是html实现窗口大小变化时页面刷新(代码)的知识。速戳>>知识兔学习精品课!