Skip to content

Instantly share code, notes, and snippets.

@nathanaelnsmith
Last active December 16, 2015 17:18
Show Gist options
  • Save nathanaelnsmith/5468952 to your computer and use it in GitHub Desktop.
Save nathanaelnsmith/5468952 to your computer and use it in GitHub Desktop.
Match all blocks in a set to the same height.
$(function(){
$('.block-grid').each(function(index){
var blocks = $.makeArray($(this).find('.block')).sort(sortByHeight)[0];
$(this).find('.block').height($(blocks).height());
});
});
function sortByHeight(a,b) {
return ($(b).height() - $(a).height());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment