Created
April 10, 2015 17:12
-
-
Save trys/5150c92497a2260694d3 to your computer and use it in GitHub Desktop.
Match column heights
This file contains hidden or 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
MatchColumnHeights: function( group, width ) { | |
var tallest = 0, | |
gCount, | |
subGroup, | |
splitGroup, | |
i; | |
splitGroup = []; | |
while ( group.length > 0 ) { | |
splitGroup.push( group.splice( 0, width ) ); | |
} | |
for ( gCount = 0; gCount < splitGroup.length; gCount++ ) { | |
tallest = 0; | |
subGroup = splitGroup[ gCount ]; | |
$( subGroup ).css('height','auto'); | |
for ( i = 0; i < subGroup.length; i++ ) { | |
tallest = Math.max( tallest, $( subGroup[ i ] ).outerHeight() ); | |
} | |
$( subGroup ).css( 'height', tallest + 'px' ); | |
} | |
} | |
ProjectNamespace.MatchColumnHeights( $( '.layout--1of3' ), 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment