Javascript get Resize window Event
window.onresize = function(event) {
...
};
//or
<script>
// Defining event listener function
function displayWindowSize() {
// Get width and height of the window
// excluding scrollbars
var w = document.documentElement.clientWidth;
var h = document.documentElement.clientHeight;
// Display result inside a div element
document.getElementById("result").innerHTML
= "Width: " + w + ", " + "Height: " + h;
}
// Attaching the event listener function
// to window's resize event
window.addEventListener("resize", displayWindowSize);
// Calling the function for the first time
displayWindowSize();
</script>