title: Creating custom .js file
body: <p>I'd like to create a custom .js file for my website so that I do not have to keep linking it within my webpages, my code works when used inline .</p>
  
  <p>Please could someone tell me why my styles.js page wont link? I'm thinking that my code is wrong?</p>
  
  <p>The current page is 'styles.js', the link I use is:   </p>
  
  
  
  <pre><code>$(document).ready(function() {
  
              $('#nav').affix({
        offset: {
          top: 90
        }
  }); 
  
  $('#sidebar').affix({
        offset: {
          top: 17
        }
  }); 
  
          });
  
  
  $(document).ready(function() {
      $(window).scroll(function() {
          if ($(this).scrollTop() &gt; 50) {
              $('#back-to-top').fadeIn();
          } else {
              $('#back-to-top').fadeOut();
          }
      });
      // scroll body to 0px on click
      $('#back-to-top').click(function() {
          $('#back-to-top').tooltip('hide');
          $('body,html').animate({
              scrollTop: 0
          }, 800);
          return false;
      });
      $('#back-to-top').tooltip('show');
  
  });
  </code></pre>