Home >Web Front-end >JS Tutorial >js gets the height and width of dom (visible area and part, etc.)_javascript skills

js gets the height and width of dom (visible area and part, etc.)_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:32:281543browse
Copy code The code is as follows:

Web page visible area width: document.body.clientWidth
Web page visible Area height: document.body.clientHeight
Visible area width of web page: document.body.offsetWidth (including the width of the edge)
Height of the visible area of ​​the web page: document.body.offsetHeight (including the height of the edge)
Web page Full text width: document.body.scrollWidth
Full text height of web page body: document.body.scrollHeight
Height of scrolled web page: document.body.scrollTop
Left side of web page scrolled: document.body .scrollLeft
Top of the main body of the web page: window.screenTop
Left of the main body of the web page: window.screenLeft
Height of the screen resolution: window.screen.height
Width of the screen resolution: window.screen .width
Screen available work area height: window.screen.availHeight
Screen available work area width: window.screen.availWidth
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