Last active
December 16, 2015 07:59
-
-
Save Melindrea/5402738 to your computer and use it in GitHub Desktop.
jQuery Plugin for making boxes equal heights
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
// Window.load to avoid FOUC in some browsers | |
$(window).load( function() { | |
/* Make boxes same height */ | |
$('.js-equal-height-columns-row').sameHeights(); | |
}); |
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 to make variable height divs equal heights | |
http://www.cre8ivecommando.com/equal-height-columns-using-jquery-6164/ | |
*/ | |
$.fn.sameHeights = function () { | |
'use strict'; | |
$(this).each(function () { | |
var tallest = 0; | |
$(this).children().each(function (i) { | |
if (tallest < $(this).height()) { tallest = $(this).height(); } | |
}); | |
$(this).children().css({'height': tallest}); | |
}); | |
return this; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment