title: Better way to get scroll Parameters?
body: <p>So, I'm trying to get some parallax scrolls in my document. So I did:</p>
  
  <pre><code>window.onscroll = function() {scrollPost()};
  
  function scrollPost () {
      var i = window.scrollY;
      blockShift(i);
      console.log(i);
  }
  
  function blockShift (i){
      var blockOne = document.querySelector(".block-1");
      var blockTwo = document.querySelector(".block-2");
      var y = i - 900
  
      if (i &lt; 980){
      blockOne.style.transform = `translateY(${y/3}px)`
      blockTwo.style.transform = `translateY(${y/-3}px)`
      } 
  }
  </code></pre>
  
  <p>However, I wonder if there's a more accurate way to get numbers? One of the problem is that scrollY number is variable depending on screen size. I've also tried.</p>
  
  <pre><code>var x = window.screen.width;
  var i = window.scrollY;
  var number = Math.round(i/x);
  </code></pre>
  
  <p>Which gives me a 0.xxxxxxx number. How would I get something better?</p>
  
  <p><strong>Edit</strong>: this also works well</p>
  
  <pre><code>var x = window.screen.width;
  var i = window.scrollY;
  var a = i / x;
  var numb = Math.round(a * 10) / 10;
  </code></pre>