Trigger function on variable change
<p>Is there a better way to monitor a variable for change and trigger a function at certain value?</p>

<p>At the moment I have this - </p>

<pre><code>$(window).on('scroll', function() {
    if(scrolledYet == "ready" &amp;&amp; positionNow &lt; 20){
        fadeOutIntro();
        scrolledYet = "yes"; 
    }
    if(scrolledYet != "ready" &amp;&amp; positionNow &lt; 840  &amp;&amp; positionNow &gt; 20 ){
        $('.logoBlock,.introScrollIcon, .introText').fadeIn('700')
           setTimeout(function() {  $('#nav').fadeIn('1000');},1000);
          setTimeout(function() {introOnOff = "on";},100)
    }
});
</code></pre>

<p>the positionNow variable is set in another function and stores the current scroll position, is there a better way to structure this script</p>
