Advertisement
Neolot

Equal height of the blocks

Oct 2nd, 2011
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Equal height of the blocks
  2. function setEqualHeight(blocks, etalon, correction){           
  3.     blocks = $(blocks);
  4.     if ( blocks.length > 1 ) {
  5.         var tallest = 0;
  6.         blocks.each(function(){
  7.             var height = $(this).outerHeight(true);
  8.             if (tallest < height) tallest = height;
  9.         });
  10.         if (etalon && tallest < etalon) {
  11.             result = etalon;
  12.         } else {
  13.             result = tallest;
  14.         }
  15.         if (correction) result = result + correction;
  16.         blocks.height(result);
  17.     }
  18. }
  19. setEqualHeight('#tabbed .box');
  20. setEqualHeight('.report-inn', $('#tabbed').outerHeight(true), -50);
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement