Advertisement
srikat

Untitled

Jul 3rd, 2013
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script type="text/javascript">
  2.         var currentTallest = 0,
  3.          currentRowStart = 0,
  4.          rowDivs = new Array(),
  5.          $el,
  6.          topPosition = 0;
  7.  
  8.         jQuery('.edd_download').each(function() {
  9.  
  10.            $el = $(this);
  11.            topPostion = $el.position().top;
  12.  
  13.            if (currentRowStart != topPostion) {
  14.  
  15.              // we just came to a new row.  Set all the heights on the completed row
  16.              for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) {
  17.                rowDivs[currentDiv].height(currentTallest);
  18.              }
  19.  
  20.              // set the variables for the new row
  21.              rowDivs.length = 0; // empty the array
  22.              currentRowStart = topPostion;
  23.              currentTallest = $el.height();
  24.              rowDivs.push($el);
  25.  
  26.            } else {
  27.  
  28.              // another div on the current row.  Add it to the list and check if it's taller
  29.              rowDivs.push($el);
  30.              currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest);
  31.  
  32.           }
  33.  
  34.           // do the last row
  35.            for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) {
  36.              rowDivs[currentDiv].height(currentTallest);
  37.            }
  38.  
  39.          });
  40.     </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement