title: jQuery.scrollTop() not triggering $(window).scroll() in IE
body: <p>I am creating a one page website where links can scroll the page down to an element specified in the hash part of the url. In Firefox &amp; Chrome it works fine, yet when trying it in IE the <code>scroll</code> event doesn't seem to be triggered on page load.</p>
  
  <p>This is the code that checks the hash and scrolls to a specific part of the document, this happens in <code>$(document).ready()</code></p>
  
  <pre><code>if(location.hash != '' &amp;&amp; location.hash != '#!/home') {     
      var obj_id = location.hash.substr(3, location.hash.length);
  
      $('html, body').scrollTop($('#'  + obj_id).offset().top - 80);
  }
  </code></pre>
  
  <p>I've tried forcing it to trigger the scroll by adding <code>$(window).scroll()</code> at the end of that code, but that just seems to reset the scroll to 0.</p>
  
  <p>Thanks,</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Sorry, I don't think I was making myself clear, but this bit of code technically works fine, but I have a <code>$(window).scroll(function() { ... });</code> event handler further on in my script which, when scrolled past a certain point, attaches my header to the top of the page.</p>
  
  <p>Here is that code:</p>
  
  <pre><code>var obj = $('#header-background');
  var obj_height = $('#header-background').outerHeight(true);
  obj.wrap('&lt;div style="width: ' + obj.outerWidth(true) + 'px; height: ' + obj_height + 'px; display: block"&gt;');
  
  var top = obj.offset().top - parseFloat(obj.css('marginTop').replace(/auto/,0)) + 20;
  
  $(window).scroll(function() {
      var y = $(this).scrollTop();
  
      if(y - (obj_height - 80) &gt;= top) {
          obj.addClass('fixed').css({
              'height': '80px'
          });
      } else {
          obj.removeClass('fixed').css({
              'height': '245px'
          }, 'fast');
      }
  });
  </code></pre>