So I currently use something like:
$(window).resize(function(){resizedw();});
But this gets called many times while resizing process goes on. Is it possible to catch an event when it ends?
So I currently use something like:
$(window).resize(function(){resizedw();});
But this gets called many times while resizing process goes on. Is it possible to catch an event when it ends?
You can use
setTimeout()
andclearTimeout()
in conjunction withjQuery.data
:Update
I wrote an extension to enhance jQuery's default
on
(&bind
)-event-handler. It attaches an event handler function for one or more events to the selected elements if the event was not triggered for a given interval. This is useful if you want to fire a callback only after a delay, like the resize event, or else. https://github.com/yckart/jquery.unevent.jsUse it like any other
on
orbind
-event handler, except that you can pass an extra parameter as a last:http://jsfiddle.net/ARTsinn/EqqHx/
I had luck with the following recommendation: http://forum.jquery.com/topic/the-resizeend-event
Here's the code so you don't have to dig through his post's link & source:
Thanks sime.vidas for the code!
ResizeStart and ResizeEnd events for window
http://jsfiddle.net/04fLy8t4/
I implemented function which trig two events on user DOM element:
Code:
Well, as far as the window manager is concerned, each resize event is its own message, with a distinct beginning and end, so technically, every time the window is resized, it is the end.
Having said that, maybe you want to set a delay to your continuation? Here's an example.