Created
October 7, 2014 14:22
-
-
Save jjeaton/32d36fdd94206b374d33 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//******************************************************** | |
// plugin for equalizing heights, responsively | |
//******************************************************** | |
(function ($) { | |
$.fn.eqHeights = function() { | |
var el = $(this); | |
if (el.length > 0 && !el.data('eqHeights')) { | |
$(window).on('resize.eqHeights', function() { | |
el.eqHeights(); | |
}); | |
el.data('eqHeights', true); | |
} | |
return el.each(function() { | |
var curHighest = 0; | |
$(this).children().each(function() { | |
var el = $(this), | |
elHeight = el.height('auto').height(); | |
if (elHeight > curHighest) { | |
curHighest = elHeight; | |
} | |
}).height(curHighest); | |
}); | |
}; | |
}(jQuery)); | |
// USAGE: | |
// ******************************************************** | |
// Equal Heights | |
// ******************************************************** | |
$('.three-col-box .boxes').eqHeights(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment