title: Scroll to anchor with differing offsets
body: <p>I've got a floating navigation bar at the top of my website and I'm using the following code to scroll to various <code>div</code> anchor points.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(document).ready(function () {
  $('a[href^="#"]').on('click', function (e) {
      e.preventDefault();
  
      var target = this.hash,
          $target = $(target);
  
      $('html, body').stop().animate({
          'scrollTop': $target.offset().top - 100 // floatnav height
      }, 900, 'swing', function () {
          window.location.hash = '1' + target;
      });
  });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>I'd like to be able to make the offset different depending on the anchor. Some of them are full page images that don't need an offset as nothing is really lost behind the navigation bar, whereas some start with text so the navigation bar needs to sit above them so that it does not hide content.</p>