Return to Snippet

Revision: 77442
at September 22, 2019 22:11 by cerxx


Initial Code
var rtime;
var timeout = false;
var delta = 200;
$(window).resize(function() {
    rtime = new Date();
    if (timeout === false) {
        timeout = true;
        setTimeout(resizeend, delta);
    }
});

function resizeend() {
    if (new Date() - rtime < delta) {
        setTimeout(resizeend, delta);
    } else {
        timeout = false;
        alert('Done resizing');
    }               
}

Initial URL
http://qaru.site/questions/33786/jquery-how-to-wait-for-the-end-of-resize-event-and-only-then-perform-an-action

Initial Description
The resizeend event.
It works for me

Initial Title
JQuery - how to wait for the \"end\" of the \"resize\" event and only then perform the action?

Initial Tags
jquery

Initial Language
JavaScript