-
-
Save juliomoreira666/d9638ed0cf439f5fd9ce1d52b53eb038 to your computer and use it in GitHub Desktop.
Small javascript plugin to make objects have the same height
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
/* | |
Usage example: | |
$(".list > .col-md-4").equalheights(); | |
*/ | |
(function ( $ ) { | |
$.fn.equalheights = function() { | |
var maxHeight = 0; | |
this.each(function(i){ | |
if(parseInt($(this).outerHeight()) > maxHeight){ | |
maxHeight = parseInt($(this).outerHeight()); | |
} | |
}); | |
this.each(function(i){ | |
height = parseInt($(this).outerHeight()); | |
diff = maxHeight - height; | |
$(this).css("height",(height+diff)+"px"); | |
}); | |
var selector = this.selector; | |
}; | |
}( jQuery )); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment