Equal height columns in Genesis

The [Genesis 6.x-2.x starter theme](http://drupal.org/project/genesis) comes with a jQuery plugin to make equal height columns a breeze. Usage is completely optional and all you need to do is uncomment the script in genesis.info, clear cache data in Performance settings and it will work.

The savvy amongst us will note that the plugin can be re-used and is not necessarily just for equalising the height of columns. You could just as easily re-purpose this for any set of boxes.

## Caveats

1. Wont resize boxes when the browser window is resized.
2. Wont resize boxes when the font size is changed.
3. In fact won't dynamically resize at all.

This is the price we pay for simplicity. Accommodating all manner of dynamic resizing could bloat the script, and at a mere 1.32kb [minified](http://en.wikipedia.org/wiki/Minify) I think its worth the trade. My view is that if you really want to support resizing there are solutions out there (or you can just write your own), and they're not that hard to implement. For Genesis I wanted something lightweight and re-usable. It also had to be easy—I think this fits the bill quite nicely.

## What does it actually do?

> equalHeights() loops through the top-level child nodes of a specified element and sets their min-height values to that of the tallest.[^1]

Note that for IE6 the script uses `height` rather than `min-height`, which is interpreted as `min-height` by IE6.

So to recap, all you need to do to use this is uncomment the script in genesis.info and clear the cache.

; Equal height columns. This will set first child divs in the #columns division
; to the same height (#sidebar-left, #sidebar-right, #content-column).
; To use just uncomment and clear cache data in Performance settings.
 
;scripts[] = js/jquery.equalizeheights.minified.js

If you have more than one subtheme and only want it for one of them, just copy/paste the minified script to your subtheme and call it from your subthemes .info file as per normal.

[^1]: [http://www.filamentgroup.com/lab/setting_equal_heights_with_jquery/](http://www.filamentgroup.com/lab/setting_equal_heights_with_jquery/)

Submitted by Jeff Burnz on

Comments

Visitor's picture

This is what is was looking

This is what is was looking for, an easy way to get the job done. I tried to build my own css layout like this but its tricky if you don't know css like the pros. I had some initial hesitation about using JS for layout but this really does work so well and even in IE6 so that's great. Thanks for the great theme, much appreciated.

Claire's picture

equal height columns

Thank-you for including this workaround in genesis. I am in the process of creating a sub-theme of genesis and need all the help I can get:))

cakezula's picture

doesn't work on 2b

i have this un-commented using the content first, two right column layout (2b) and it doesn't extend my columns.

cakezula's picture

i should mention i am running

i should mention i am running the drupal 6.12 and have the latest version of genesis (released june 12 2009).

Jeff Burnz's picture

Yea it does, you may need to

Yea it does, you may need to adjust the div its operating on - open up jquery.equalizeheights.minified.js and look for the last line of code and change it to this:

if(Drupal.jsEnabled){$(document).ready(function(){$('.columns-inner').equalHeights();});}

Whats changing is #columns to .columns-inner.

Another gotcha is showing user pictures, sometimes the script has a hard time calculating the heights of columns and I've found setting a height on the user picture (in the CSS) fixes many problems.

BTW, it doesnt matter what layout you are using because the HTML is always the same.

cakezula's picture

thanks!!!

that did it! thanks so much for your prompt reply! that light bulb wouldn't have lit itself above my head. :)

comment #5

Comment #5 saved me a few hours of problem solving.
I am now genesis biggest fan :)