title: Script works inline but when i move to external doesnt work?
body: <p>I just made a script for my navigation. So that it becomes a sticky navigation once it is scrolled to the top. </p>
  
  <p>It works great when i have it at the bottom of my index file via <code>&lt;script&gt;</code> tags but when i try to place it in an external js file it doesnt seam to fire at all.</p>
  
  <p><strong><a href="https://jsfiddle.net/7zwyL496/" rel="nofollow">Full Fiddle</a></strong></p>
  
  <p><strong>Heres the script:</strong></p>
  
  <pre><code>var windw = this;
  $.fn.followTo = function ( pos ) {
      var $this = this,
          $window = $(windw);
      $window.scroll(function(e){
          if ($window.scrollTop() &gt; pos) {
              $this.css({
                  position: 'fixed',
                  top: "20px"
              });
          } else {
              $this.css({
                  position: 'absolute',
                  bottom: '0',
                  left: '0', right:'0',
                  top: 'inherit'
  
              });
  
          }
      });
  
  };
  $('#mainNav').followTo( $(window).height() - ( $('#mainNav').innerHeight() + $('.globalHeader').innerHeight() ));
  </code></pre>