I have javascript code which calculates the height of container.
Two situations:
Correct Height - When I do a hard refresh at the top of the page.
Incorrect Height - When I do a hard refresh somewhere in the middle of the page.
jQuery
jQuery( document ).ready(function() {
if (jQuery('.sidebar').length){
var $sidebar = jQuery('.sidebar');
var $container = jQuery('.syllabus-container');
var $writerContainer = jQuery('.writer-container');
var sideBottom = parseFloat($sidebar.css('top')) + $sidebar.height();
var contBottom = $container.offset().top + $container.height();
}
});
I don't really have a live example, but basically the problem lies in that last line, where it does $container.height()
. Can anyone think of any reason for this?