JavaScript 获取页面总高度:document.documentElement.scrollHeight 或 document.body.scrollHeight
This code returns the height of the entire document, including any content that extends beyond the visible viewport. It first checks if the 'scrollHeight' property of the HTML element is defined and returns its value if so. Otherwise, it returns the 'scrollHeight' property of the 'body' element. The 'scrollHeight' property returns the height of an element's content, including any content that overflows outside the element's dimensions and is only accessible through scrolling.
原文地址: https://www.cveoy.top/t/topic/nIaX 著作权归作者所有。请勿转载和采集!