html窗口大小变化,刷新当前页面

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/liu709127859/article/details/81776527

<!DOCTYPE html>
<html lang="en">
<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>

猜你喜欢

转载自blog.csdn.net/liu709127859/article/details/81776527
今日推荐