Javascript Browser Window handle resize event
<!DOCTYPE html> <html> <body> <p>Try to resize the browser window.</p> <p>Window resized <span id="demo">0</span> times.</p> <script> window.addEventListener("resize", myFunction); var x = 0;/*from w w w. ja va 2 s .c o m*/ function myFunction() { var txt = x += 1; document.getElementById("demo").innerHTML = txt; } </script> </body> </html>