26 lines
798 B
JavaScript
26 lines
798 B
JavaScript
// make sure the $ is pointing to JQuery and not some other library
|
|
(function($){
|
|
// add a new method to JQuery
|
|
|
|
$.fn.equalHeight = function() {
|
|
// find the tallest height in the collection
|
|
// that was passed in (.column)
|
|
lowest = tallest = 0;
|
|
adjust = 10; // Just to make it look a little neater (plus for some reason the footer stomps on the highest column
|
|
this.each(function() {
|
|
thisHeight = $(this).height();
|
|
thisOffset = $(this).offset();
|
|
if (thisOffset.top && thisHeight > tallest)
|
|
tallest = thisHeight;
|
|
if (thisOffset.top > lowest)
|
|
lowest = thisOffset.top;
|
|
});
|
|
|
|
// set each items height to use the tallest value found
|
|
this.each(function() {
|
|
thisOffset = $(this).offset();
|
|
$(this).height(lowest-thisOffset.top+tallest+adjust);
|
|
});
|
|
}
|
|
})(jQuery);
|