How to hide the scroll up button and make it visible when we reach the bottom of the page.
1 Like
Try to Google before posting your queries here.
This is the code block which will hide the button until we reach bottom of the page.
mybutton = document.getElementById("myBtn");
window.onscroll = function () { scrollFunction() };
function scrollFunction() {
if ((window.innerHeight + window.scrollY)
>= document.body.offsetHeight) {
mybutton.style.display = "block";
} else {
mybutton.style.display = "none";
}
}
1 Like