曹え 5811 发布于:2022-12-02 02:38:37
<style> #tips { display: none; position: fixed; top:0; left: 0; width: 100%; height: 100%; background-color: #000; text-align: center; line-height: 100vh; font-size: 20px; color:#fff; } </style> <div id="tips"> <p>请竖屏浏览</p> </div> <script> function hengshuping() { var w = $(window).width() var h = $(window).height() console.log(w,h) if (w<=1024 && w>h) { $('#tips').fadeIn() } else { //竖屏 $('#tips').fadeOut() } } hengshuping() $(window).resize(function(){ hengshuping() }) </script>
登录后可以留言提问!
微信扫码登录