Last active
August 29, 2015 14:27
-
-
Save Ourelius/21cec5536713e33e864d 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
/*** | |
Equal Heights | |
***/ | |
function matchHeight() { | |
var location = $('.row > .container'); // location | |
location.each(function(i, el){ | |
var set = $('> div', el); | |
var equal = []; // init an empty array | |
set.css({'height' : ''}); // reset height for resizeEvent | |
set.each(function(){ | |
var elementHeight = $(this).height(); // get height of element | |
equal.push(elementHeight); // push it to array | |
}); | |
equal.sort(function(a, b){ | |
return b-a; // sorting DESC | |
}); | |
set.height(equal[0]); // adding equal heights to divs | |
}); | |
} | |
$(document).ready(function(){ matchHeight(); }); | |
$(window).on('resize', function(){ matchHeight(); }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment