jquery实现监听浏览器窗口大小

xiaoxiao2025-10-01  10

<!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"> <title>Document</title> </head> <body> </body> <script src="https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script> <script> $(window).bind("load resize",function(){ document.documentElement.clientWidth >= 600 ? console.log("hello") : console.log("xiaoyu600") }); //第二种 $(window).bind("load resize",function(){ if(document.documentElement.clientWidth >= 600) console.log("hello111") }); </script> </html>

 

转载请注明原文地址: https://www.6miu.com/read-5037192.html

最新回复(0)