This article describes the method of triggering events when the size of the browser window is changed. Share it for your reference. The specific analysis is as follows:
Event triggered when the browser's window size is changed window.onresize
Specify code for the event:
Copy the code as follows: window.onresize = function(){
}
For example:
Viewable area information of the browser:
Copy the code as follows: <span id="info_jb51_net">Please change the browser window size</span>
<script>
window.onresize = function(){
document.getElementById("info_jb51_net").innerHTML="Width:"+document.documentElement.clientWidth+", height: "+document.documentElement.clientHeight;
}</script>
PS: Here we provide you with an online tool about JS events, which summarizes the commonly used event types and function functions of JS:
A complete list of javascript events and functions:
http://tools.VeVB.COM/table/javascript_event
I hope this article will be helpful to everyone's JavaScript programming.