Home >Web Front-end >JS Tutorial >js gets the height of the visible area, text and screen resolution of the web page_javascript skills

js gets the height of the visible area, text and screen resolution of the web page_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:48:031978browse

The width of the visible area of ​​the web page: document.body.clientWidth
The height of the visible area of ​​the web page: document.body.clientHeight
The width of the visible area of ​​the web page: document.body.offsetWidth (including the width of the edges)
The height of the visible area of ​​the web page: document.body.offsetHeight (including the height of the edge)
Full text width of the web page body: document.body.scrollWidth
Full text height of the web page body: document.body.scrollHeight
Scrolled height of the web page: document.body .scrollTop
The left side of the webpage being scrolled: document.body.scrollLeft
The upper body of the webpage: window.screenTop
The left side of the webpage body: window.screenLeft
High screen resolution: window. screen.height
Width of screen resolution: window.screen.width
Screen available work area height: window.screen.availHeight
Screen available work area width: window.screen.availWidth

Because I haven’t been able to remember these, I should be able to remember them if I look at them frequently

With this, I can dynamically load image codes

Copy code The code is as follows:

document.onmousewheel = function () {
var scrollTop = document.documentElement.scrollTop || document.body. scrollTop;
var hght = document.body.scrollHeight;
if (scrollTop document.documentElement.clientHeight >= hght) {
/*Write the code for loading images here*/
}
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