自动检测Web浏览器的窗口宽度变化? [英] automatically detect web browser window width change?

查看:333
本文介绍了自动检测Web浏览器的窗口宽度变化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道您使用$(window).width()可以获取Web浏览器的大小.

i know that you with $(window).width() can get the size of the web browser.

我想检测用户何时更改其网络浏览器的大小,以便重新调整列宽.有没有一种方法可以自动检测到这一点,或者我必须使用setTimeinterval进行循环并查看其是否已更改?

i want to detect when the user change the size of his web browser so i could readjust the columns width. is there a way to automatically detect this or do i have to use setTimeinterval to loop and see if it has changed?

推荐答案

尝试调整大小事件

$(window).resize(function() {
  console.log('window was resized');
});

这篇关于自动检测Web浏览器的窗口宽度变化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆