O
O
olya_0972018-03-09 13:04:14
JavaScript
olya_097, 2018-03-09 13:04:14

What does document.documentElement and the if line mean?

By clicking on the button, check if the page is scrolled to the very bottom. If so, scroll it to position 100px from the top
var button = document.getElementById('button');
button.addEventListener('click', func);
function func() {
var body = document.documentElement;
if (body.scrollHeight - body.scrollTop == body.clientHeight) {
window.scrollTo(0, 100);
}
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question