title: jQuery fixed item when scrolling reset when at top?
body: <p>I have a navigation menu in the header at the top of the screen that changes color and adds fixed positioning when the user scrolls down the screen to keep it in place but I would like this to reset to the original style when the user scrolls back to the top.</p>
  
  <p>My current code to add the fixed class is:</p>
  
  <pre><code>$(function() {
      var offset = $("header").offset();
      $(window).scroll(function () {  
      var scrollTop = $(window).scrollTop();
          if (offset.top &lt; scrollTop) {
              $("header").addClass("fixed");
          } else {
              $("header").removeClass("fixed");
          }
      });
  });
  </code></pre>
  
  <p>But I would like this to remove the class when the user scrolls to the top again which it currently isn't doing.</p>
  
  <p>Regards,</p>
  
  <p>Thomas.</p>