- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the usage of onresize event in JavaScript?
The resize event is triggered when the window is resized. Use window.outerWidth and window.outerHeight event in JavaScript to get the size of windows when the browser is resized.
Example
You can try to run the following code to work with an onresize event in JavaScript.
<!DOCTYPE html> <html> <head> <script> function resizeFunction() { var val = "Window Width=" + window.outerWidth + ", Window Height=" + window.outerHeight; document.getElementById("test").innerHTML = val; } </script> </head> <body onresize="resizeFunction()"> <p>Resize browser window and check the window (browser window) height and width again.</p> <p id = "test"> </p> </body> </html>
Advertisements
To Continue Learning Please Login
Login with Google