user246114
user246114

Reputation: 51611

Notification of browser size change?

Is it possible to get notified when the browser window size changes? This might happen when the user resizes the browser window etc. I need to resize an element in response to size change,

Thanks

Upvotes: 1

Views: 668

Answers (1)

Chris Laplante
Chris Laplante

Reputation: 29658

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.

Upvotes: 3

Related Questions