title: offsetHeight not working properly in chrome
body: <p>I come across a funny problem. I don't know the what could be the reason. I tried to search on internet but no solutions I got. The problem is offsetWidth is working perfect in Chrome but offsetHeight is not working properly. Sometime it returns the value but sometime not. May I know is there any solution to sort out this issue. </p>
  
  <p>Note: I have tried to use id.height, id.clientHeight. But all are giving me the same problem. In my projects we use Prototype and JQuery also. </p>
  
  <p>I have used prototype getHeight() also.. but not working in Chrome. getWidth() is working perfect. But all these are working well in Firefox... :(</p>
  
  <p><strong>This is the code block</strong></p>
  
  <pre><code>$('leftImage_&lt;?php echo $iExtLoop; ?&gt;').style.position="relative";
  $('leftImage_&lt;?php echo $iExtLoop; ?&gt;').style.left= ($('leftImageDiv').offsetWidth - $('leftImage_&lt;?php echo $iExtLoop; ?&gt;').offsetWidth)/2 + "px";
  $('leftImage_&lt;?php echo $iExtLoop; ?&gt;').style.top= ($('leftImageDiv').offsetHeight - $('leftImage_&lt;?php echo $iExtLoop; ?&gt;').offsetHeight)/2 + "px";
  
  if($('stripLeft_&lt;?php echo $iExtLoop; ?&gt;')){
      $('stripLeft_&lt;?php echo $iExtLoop; ?&gt;').style.position="relative";
      $('stripLeft_&lt;?php echo $iExtLoop; ?&gt;').style.left= ($('leftImageDiv').offsetWidth - $('stripLeft_&lt;?php echo $iExtLoop; ?&gt;').offsetWidth) + "px";
      $('stripLeft_&lt;?php echo $iExtLoop; ?&gt;').style.top= ($('leftImageDiv').offsetHeight - $('stripLeft_&lt;?php echo $iExtLoop; ?&gt;').offsetHeight) + "px";                                      
  }
  </code></pre>
  
  <hr>
  
  <p>Refactored code, added by Šime Vidas:</p>
  
  <pre><code>var img = $( 'leftImage_&lt;?php echo $iExtLoop; ?&gt;' );
  var div = $( 'leftImageDiv' );
  var strip = $( 'stripLeft_&lt;?php echo $iExtLoop; ?&gt;' );
  
  img.style.position = "relative";
  img.style.left = ( div.offsetWidth - img.offsetWidth ) / 2 + "px";
  img.style.top = ( div.offsetHeight - img.offsetHeight ) / 2 + "px";
  
  if ( strip ) {
      strip.style.position = "relative";
      strip.style.left = ( div.offsetWidth - strip.offsetWidth ) + "px";
      strip.style.top= ( div.offsetHeight - strip.offsetHeight ) + "px";
  }
  </code></pre>