title: Jumping div in Safari and Chrome. jQuery/Javascript
body: <p>I have a div #HangerLeft that the css.right is automatically generated via jQuery to sit on the left side of the page based on the body width. It is absolute positioned.</p>
  
  <pre><code>function hangerLeft() {
    var hangerPosition = (jQuery("body").innerWidth() / 2) + (990 / 2);
    jQuery("#HangerLeft").css("position","absolute").css("right", hangerPosition +"px").css("top","20px");
  }
  </code></pre>
  
  <p>Inside the #HangerLeft div I have a #scrollWrapper div with no positioning and inside the #scrollWrapper i have a #scrollBox. The #scrollBox is absolute positioned. </p>
  
  <pre><code>#scrollWrapper { width:130px; height:400px; border:1px solid #fff;}
  
  #scrollBox { position: absolute; top: 100; margin-top: 25px; padding-top: 0px;}
  
  #scrollBox.fixed { position: fixed; top: 0;}
  </code></pre>
  
  <p>The #scrollBox sits until you scroll. Once you scroll past the top of the #scrollBox div javascript adds a class to make the #scrollBox position:fixed instead of absolute.</p>
  
  <pre><code>&lt;script&gt;
  $(function () {
  
  var msie6 = $.browser == 'msie' &amp;&amp; $.browser.version &lt; 7;
  
  if (!msie6) {
  var top = $('#scrollBox').offset().top - parseFloat($('#scrollBox').css('margin-top').replace(/auto/, 0));
  $(window).scroll(function (event) {
    // what the y position of the scroll is
    var y = $(this).scrollTop();
  
    // whether that's below the form
    if (y &gt;= top) {
      // if so, ad the fixed class
      $('#scrollBox').addClass('fixed');
    } else {
      // otherwise remove it
      $('#scrollBox').removeClass('fixed');
    }
   });
  }  
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>In Firefox and IE this works fine. </p>
  
  <p>In Safari and Chrome once the #scrollBox javascript hits, the #scrollBox div jumps out of the #HangerLeft div into the middle of the page and ignores the positioning of the #HangerLeft div.</p>
  
  <p>I have been battling this for 2 weeks and am at a loss.</p>
  
  <p>Any help would be appreciated. </p>