Skip to content

Instantly share code, notes, and snippets.

@spencejs
Created March 22, 2013 06:00
Show Gist options
  • Save spencejs/5219301 to your computer and use it in GitHub Desktop.
Save spencejs/5219301 to your computer and use it in GitHub Desktop.
Equal Height Columns By Class
/*Set Equal Column heights unless Width < 800px */
var maxHeight = 0;
var eventFired = 0;
if (jQuery(window).width() <= 800) {
} else {
jQuery(".equalize").each(function(){
if (jQuery(this).height() > maxHeight) { maxHeight = jQuery(this).height(); }
});
jQuery(".equalize").height(maxHeight);
}
jQuery(window).on('resize', function() {
if (!eventFired) {
if (jQuery(window).width() <= 800) {
jQuery(".equalize").height('auto');
} else {
jQuery(".equalize").each(function(){
if (jQuery(this).height() > maxHeight) { maxHeight = jQuery(this).height(); }
});
jQuery(".equalize").height(maxHeight);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment