Answer the question
In order to leave comments, you need to log in
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 questionAsk a Question
731 491 924 answers to any question