Post

Getting True Height with jQuery

rulerI’ve come across this issue multiple times when trying to get the height of a content area (that contains images) using Javascript. In Webkit browsers (like Safari & Chrome), the height you retrieve will be minus any image heights, therefore not a true height. The reason for this is the order in which webkit loads images. The simple solution to this issue is to make your call using window.load instead of document.ready, like this:

$(window).load(function(){
   var elementHght = $('#content').height();
});

(Source: stackoverflow.com)

  1. msr1k reblogged this from clintmckoy
  2. clintmckoy posted this