Как получить полную высоту веб-страницы с помощью javascript? Например, веб-страница составляет 4138 пикселей. Как получить его с помощью javascript??? Клиентский экран дает только высоту экрана, я не хочу этого.
Вы можете найти высоту веб-страницы с помощью outerHeight
. У вас должен быть jQuery на сайте. Используйте следующее:
$('body').outerHeight()
Для простого Javascript используйте этот код:
var height = document.querySelector('body').clientHeight
console.log(height)
To get the height of the Web Page using javascript, you can make use of the method "height". Here is an example where you can get the height of the webpage using javascript in pixel
<!DOCTYPE html>
<html>
<body>
<p>Click the button to display the total height of your screen, in pixels.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = "Height of the Screen in Pixel is : " + screen.height + "px";
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
Таким образом, метод "screen.height" даст вам высоту пикселя.