Home  >  Article  >  Web Front-end  >  js method to trigger events when the browser window size is changed_javascript skills

js method to trigger events when the browser window size is changed_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:16:111849browse

The example in this article describes the js method of triggering events when the browser window size is changed. Share it with everyone for your reference. The specific analysis is as follows:

The event window.onresize is triggered when the browser window size is changed

Specify a code for the event:

Copy code The code is as follows:
window.onresize = function(){

}

For example:

Browser visible area information:

Copy code The code is as follows:
Please change the browser window size< /span>
<script><br> window.onresize = function(){<br> document.getElementById("info_jb51_net").innerHTML="Width: " document.documentElement.clientWidth ", Height: " document.documentElement.clientHeight;<br> }</script>

I hope this article will be helpful to everyone’s JavaScript programming design.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn