Skip to content

Instantly share code, notes, and snippets.

@Neolot
Created July 13, 2012 16:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Neolot/3105730 to your computer and use it in GitHub Desktop.
Save Neolot/3105730 to your computer and use it in GitHub Desktop.
JQUERY Блоки равной высоты
// Equal height of the blocks
function setEqualHeight(blocks, etalon, correction){
blocks = $(blocks);
if ( blocks.length > 1 ) {
var tallest = 0;
blocks.each(function(){
var height = $(this).outerHeight(true);
if (tallest < height) tallest = height;
});
if (etalon && tallest < etalon) {
result = etalon;
} else {
result = tallest;
}
if (correction) result = result + correction;
blocks.height(result);
}
}
setEqualHeight('#tabbed .box');
setEqualHeight('.report-inn', $('#tabbed').outerHeight(true), -50);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment