Как узнать высоту всей страницы (вместе с прокруткой) от начала header
до конца footer
?
Добавить комментарий
|
2 ответа
Простым js:
var B = document.body,
H = document.documentElement,
height
if (typeof document.height !== 'undefined') {
height = document.height // For webkit browsers
} else {
height = Math.max( B.scrollHeight, B.offsetHeight,H.clientHeight, H.scrollHeight, H.offsetHeight );
}
jquery: $(document).height()
Если имеется в виду высота контента между тэгами <header>
и <footer>
:
document.querySelector('.content').clientHeight;