title: Window width on Chrome and Firefox error
body: <p>I have the following code:</p>
  
  <pre><code>function c() {
          var h = ($(window).height() - $('#maincontainer').outerHeight()) / 2;
          var w = ($(window).width() - $('#maincontainer').outerWidth()) / 2;
  
          $('#maincontainer').css('position', 'absolute');
          $('#maincontainer').css('top', h);
          $('#maincontainer').css('left', w);
      }
  
      $(window).resize(c);
      $(window).load(c);
  </code></pre>
  
  <p>The <code>resize</code> event works properly on every browser I tried but the <code>load</code> always returns a width value of 8px, putting the <code>maincontainer</code> div on the left border of the screen.
  This executes properly putting a div on the middle on the window only on IE8, failing on Chrome 22 and Firefox 16.</p>
  
  <p>EDIT:
  The solution that seemed to work:</p>
  
  <pre><code>    $(window).ready(c);
      $(window).load(c);
      $(window).resize(c);
  </code></pre>
  
  <p>Also, <code>the body</code> should have <code>width: 100%</code>.</p>