Do something after jQuery resize or scroll is done, or has paused.

Instead of firing the event every time the resize/scroll is detected, which is constantly during a resize/scroll operation, this fires a designated amount of time after the last resize/scroll event has fired.

var id;
$(window).on("resize", function() {
    id = setTimeout(doResizeEvent, 200);


function doResizeEvent(){
  console.log("Done resizing!");

Similar answer on which I based my code above:

Example from answer: