Skip to content

Instantly share code, notes, and snippets.

@htuscher
Created October 29, 2014 12:33
Show Gist options
  • Save htuscher/7e5f946489ccd57773bb to your computer and use it in GitHub Desktop.
Save htuscher/7e5f946489ccd57773bb to your computer and use it in GitHub Desktop.
/**
* Equalizer for height of elements
*/
$('.equalizer').each(function() {
var heights = $(this).find('.watch').map(function() {
return $(this).height();
}).get(),
maxHeight = Math.max.apply(null, heights);
$('.watch').height(maxHeight);
});
/*
* Usage:
* The elements with class watch will get the equal
* height inside an equalizer container
*
* <div class="equalizer">
* <span class="watch">...</span>
* <span class="watch">...</span>
* </div>
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment