title: Why this works different if I use functions parameters instead of fixed values?
body: <p>I´m begining with JQuery and Javascript and doing a parallax scroll exercise, a question arose to me.</p>
  
  <ul>
  <li><p>I was writing the value of a var in a <code>&lt;p&gt;&lt;/p&gt;</code> every time that user makes scroll.</p></li>
  <li><p>That value is the result of an operation between the value of the scroll position and another value.</p></li>
  <li><p>If I put this last value like a fixed number in the function, it works and the number changes every time I use the scroll bar, but if I put this value like a parameter in the function, the function only calculate the first movement of the scroll and put that result in the <code>&lt;p&gt;&lt;/p&gt;</code>.</p></li>
  </ul>
  
  <p>These are the two codes:</p>
  
  <ol>
  <li><p>Numbers in <code>&lt;p&gt;&lt;/p&gt;</code> changes every time i move the scroll</p>
  
  <pre><code>$(window).on("scroll", parallax);    
  function parallax(){
  var scrollSize=$(window).scrollTop();
  var scrollParallax=Number(scrollSize*0.5);
  $("p").text(scrollParallax);
  }
  </code></pre></li>
  <li><p>Number in <code>&lt;p&gt;&lt;/p&gt;</code> doesn´t changes, shows only the first value of the var</p>
  
  <pre><code>$(window).on("scroll", parallax(0.5));
  function parallax(medida){
  var scrollSize=$(window).scrollTop();
  var scrollParallax=Number(scrollSize*medida);
  $("p").text(scrollParallax);
  }
  </code></pre></li>
  </ol>
  
  <p>What is the difference?</p>
  
  <p>Why is this happening?</p>