Skip to content

Instantly share code, notes, and snippets.

@danreb
Created September 17, 2012 06:22
Show Gist options
  • Save danreb/3735823 to your computer and use it in GitHub Desktop.
Save danreb/3735823 to your computer and use it in GitHub Desktop.
Making division with class twins with the same heights using jQuery Equalheights plugin in Drupal theme
Make sure you include jquery equal heights plugin before using this snippet of code. Add entry reference to your scripts in your theme .info file.
(function ($) {
$(document).ready(function() {
// Make div with class twins equal in heights
$(".twins").equalHeights();
});
})(jQuery);
/**
* This one doesn't need jQuery plugin, script courtesy of Paul Irish
* Make div or element with the same heights.
*/
(function ($) {
// Run when document is ready
$(document).ready(function() {
// create function that will check heights
$.fn.setAllToMaxHeight = function(){
return this.height( Math.max.apply(this, $.map( this , function(e){ return $(e).height() }) ) );
}
// Equalize Heights
$('.twins').setAllToMaxHeight();
});
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment