Advertisement
Guest User

Untitled

a guest
May 25th, 2016
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. $(window).on("load resize", function(){
  2. console.log($('body').width());
  3. equalheight('.PriserColumn');
  4. equalheight('.LogoWrapperBox');
  5. equalheight('.ProductContainer');
  6. equalheight('.ProductContainer-2');
  7. });
  8.  
  9. equalheight = function(container) {
  10.  
  11. var
  12. currentTallest = 0,
  13. currentRowStart = 0,
  14. rowDivs = new Array(),
  15. $el,
  16. topPosition = 0;
  17.  
  18. $(container).each(function() {
  19.  
  20. $el = $(this);
  21. $($el).height('auto')
  22. topPostion = $el.position().top;
  23.  
  24. if (currentRowStart != topPostion) {
  25. for (currentDiv = 0; currentDiv < rowDivs.length; currentDiv++) {
  26. rowDivs[currentDiv].height(currentTallest);
  27. }
  28. rowDivs.length = 0; // empty the array
  29. currentRowStart = topPostion;
  30. currentTallest = $el.height();
  31. rowDivs.push($el);
  32. } else {
  33. rowDivs.push($el);
  34. currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest);
  35. }
  36. for (currentDiv = 0; currentDiv < rowDivs.length; currentDiv++) {
  37. rowDivs[currentDiv].height(currentTallest);
  38. }
  39. });
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement