Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect the mouseup at the end of a window resize?

I'm looking for a way to detect the mouseup event at the very end of a window resizing (when done by dragging). (AFAICT, this event is not picked up by a resize handler on $(window) or on $(document).)

PS: for my purposes it is OK to define a "drag-resize" as the resizing that takes place between a mousedown (on a suitable resizing locus on the window) and its corresponding mouseup event, disregarding any pauses the user may make, while still holding down the mouse button, between those two end points.

like image 779
kjo Avatar asked Dec 17 '13 12:12

kjo


1 Answers

$ npm install resizeend

or add to your page:

<script src="https://raw.githubusercontent.com/jeremenichelli/resizeend/master/dist/resizeend.min.js"></script>

and then just use the event:

window.addEventListener('resizeend', function() {
    alert('You are not resizing the window anymore!');
});
like image 164
Ilya Kharlamov Avatar answered Sep 21 '22 17:09

Ilya Kharlamov