Posted By

mikemetcalf on 09/18/09


jquery equalheights solaray

Versions (?)

Match height

 / Published in: jQuery

If the height of the main column is ever shorter than the height of the right column, the main column will grow to match its height.

This script was used on the Solaray project.

  1. $(function() {
  2. mainHeight = $(".container_650").height();
  3. rightHeight = $(".container_right").height();
  5. if(mainHeight < rightHeight) {
  6. $(".container_650").height(rightHeight-30);
  7. }
  8. });

Report this snippet  


RSS Icon Subscribe to comments
Posted By: mikemetcalf on June 4, 2010

For Safari, consider running this script inside a $(window).load instead of jQuery's typical document.ready. Safari incorrectly loads scripts in document.ready before CSS is fully loaded, which will cause this script to not work.

$(window).load(function(){ // the script above });

You need to login to post a comment.