resizHandler

resizeHandler

by Snj

JavaScript

function resizHandler () {
    if(this.resizeTO) clearTimeout(this.resizeTO);
    this.resizeTO = setTimeout(function() {
      $(this).trigger('resizeEnd');
    }, 550);
}

$(window).bind('resizeEnd', function() { // Listens for when resize function is done.
    console.log('Resizing...')
});


function startResize() { $(window).bind('resize', resizHandler); }
function endResize() { $(window).off("resize", resizHandler); }

startResize()
setTimeout(function(){ endResize() }, 6000);