开发者

Notification of browser size change?

开发者 https://www.devze.com 2023-01-15 07:58 出处:网络
Is it possible to get notified when the browser window size changes? This might happen when the user resizes the brow开发者_如何转开发ser window etc. I need to resize an element in response to size ch

Is it possible to get notified when the browser window size changes? This might happen when the user resizes the brow开发者_如何转开发ser window etc. I need to resize an element in response to size change,

Thanks


Yes: http://api.jquery.com/resize/

but the event fires crazily. Use this instead (second example down):

http://benalman.com/code/projects/jquery-dotimeout/examples/debouncing/

When resizing the window, the resize event will trigger at every interval, instead of triggering only when the resize event is finished. Use debouncing to ensure that it doesn't fire at every interval.

0

精彩评论

暂无评论...
验证码 换一张
取 消