Created
November 8, 2019 10:59
-
-
Save richardevcom/0fa5da380a11a19ef59139735ad11606 to your computer and use it in GitHub Desktop.
window before / on / after resize event
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var resizeTimer; | |
var timeoutInterval = 100; // Timeout interval for resize timer | |
window.onresize = function(event) { | |
var status = document.getElementById("status"); | |
// ON RESIZING | |
status.innerHTML = "Resizing..."; | |
clearTimeout(resizeTimer); | |
resizeTimer = setTimeout(function() { | |
// AFTER RESIZING | |
status.innerHTML = "Resizing done."; | |
}, timeoutInterval); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Working example: https://codepen.io/richardev/pen/QWWrvOp