Check if a User Has Scrolled to the Bottom of Page Using Javascript

You can use this script to check if a user has scrolled to the bottom of page, for example to show header, show navigation/menu, show button “back to top”, etc.

window.addEventListener('scroll', function (event) {
  if (document.documentElement.scrollHeight <= window.pageYOffset + window.innerHeight)  {
    alert('You are at the bottom of page!');

For live example, scroll to the bottom of this page then you will see the header of this website slide up.