Created
September 17, 2012 06:22
-
-
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
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
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. |
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
(function ($) { | |
$(document).ready(function() { | |
// Make div with class twins equal in heights | |
$(".twins").equalHeights(); | |
}); | |
})(jQuery); |
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
/** | |
* 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