Js method to trigger an event when the browser window size is changed. js browser window
This example describes how to trigger an event when the browser window size of JavaScript is changed. Share it with you for your reference. The specific analysis is as follows:
Event window. onresize triggered when the browser window size is changed
Specify code for the event:
Copy codeThe Code is as follows: window. onresize = function (){
}
For example:
Visible area information of the browser:
Copy codeThe Code is as follows: <span id = "info_jb51_net"> change the browser window size. </span>
<Script>
Window. onresize = function (){
Document. getElementById ("info_jb51_net"). innerHTML = "width:" Your document.doc umentElement. clientWidth + ", height:" Your document.doc umentElement. clientHeight;
} </Script>
I hope this article will help you design javascript programs.