jq 监听调整浏览器窗口的大小

Posted 遇事稳坐钓鱼台

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jq 监听调整浏览器窗口的大小相关的知识,希望对你有一定的参考价值。

<html>
<head>
<script type="text/javascript" src="http://www.w3school.com.cn/jquery/jquery.js"></script>
<script type="text/javascript">
x=0;
$(document).ready(function(){
$(window).resize(function() {
$("span").text(x+=1);
});

});
</script>
</head>
<body>
<p>窗口大小被调整过 <span>0</span> 次。</p>
<p>请试着重新调整浏览器窗口的大小。</p>
</body>
</html>

 

演练网址:http://www.w3school.com.cn/jquery/event_resize.asp

以上是关于jq 监听调整浏览器窗口的大小的主要内容,如果未能解决你的问题,请参考以下文章