How can I display a numeric value on a website that corresponds with scroll distance?

I am looking to make a webpage with the same concept as enter link description here that displays relative distance between planets. I can't tell if this is a premade jquery plugin or custom built. TIA

Answers 1

  • You can listen for window 'scroll' change event.

    window.addEventListener('scroll',function(event){
      console.log(window.scrollY); // for vertical scrolling
      console.log(window.scrollX); // for horizontal scrolling
    })


Related Articles