Skip to content

Instantly share code, notes, and snippets.

@andfinally
Created October 2, 2013 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andfinally/6792099 to your computer and use it in GitHub Desktop.
Save andfinally/6792099 to your computer and use it in GitHub Desktop.
Periodically check the height of the main content container and reset its height to accommodate any increase in the height of its children that might've happened. Content container has overflow hidden. Content like FB comments can increase in height after page load.
// Make the contentArea height equal to the paneVisible height. (We view the latter through the former.)
var updateHeight = function(){
var height = $(paneVisible).children().height();
if (height) {
$(contentArea).height(height + paneVisibleMargin);
}
};
// Set a periodic height adjustment for the content area. Necessary to account for diverse heights of side-panes as they slide in, and dynamic page elements.
setInterval(function(){
updateHeight();
}, 509); // Prime number, for good luck
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment