I have used jQuery 1.6.2 so I can get <div id="drag-container"> width and height and it was working fine
But when I changed to jQuery 1.7.1 I start to have a problem with IE (9.0)
in $(document).ready() function
$("#drag-container").height() returns 0
and the web page stops it’s initial rendering for a 5 seconds.
In fact page is almost fully rendered except (may be) the same <div id="drag-container">
Can this be my fault?
I’m also using HTML5 Boilerplate and Twitter Bootstrap with Less
If there are images in the
#drag-containerelement, then you should use the$(window).load()(as you rightly corrected in the comment) instead of the.ready().That is because the
readyevent is fired once the DOM is ready to be manipulated (the actual html) while theloadevent is fired once all assets of the page have been loaded (including images etc).So your code will be running before the images are loaded, and thus their container will not have acquired its height (which might depend on its content – the images..)