I have experience this issue several times, and the best solution, without the use of any plugins or unruly setTimeout functions, is to use hook into the browser's onLoad event. With jQuery, it's done like so:
$(window).load(function(){ ...outerHeight logic goes here... });
This could be totally separate from your standard $(function(){ ...code... });
so all of your other properly working code doesn't have to wait until every single element on the page has loaded.
Why this happens in the first place:
Chrome has a different rendering algorithm than Firefox, which causes it to trigger the onLoad event before all the elements on the page are completely drawn/displayed and available for jQuery to select and retrieve heights. setTimeout()
will work most of the time, but you don't want to develop a dependency on something so blind by nature – who knows, in the future this "quirk" in Chrome could be fixed! :)
.outerHeight({margin: true});
– Skipp