Home > Web Front-end > JS Tutorial > 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
Release: 2016-05-16 16:16:11
Original
1863 people have browsed it

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.

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template