Created
July 13, 2012 16:11
-
-
Save Neolot/3105730 to your computer and use it in GitHub Desktop.
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
// 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