Advertisement
saren86

wyrownywanie 2

Jan 4th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. function productHeights(inRow, selector, param_arr) {
  3.     var elems = selector.find(".product_wrapper");
  4.  
  5.     for (var i = 0; i < elems.length; i += inRow) {
  6.         var divs = elems.slice(i, i + inRow);
  7.  
  8.         param_arr.forEach(function (elem) {
  9.             divs.find(elem).attr('style', '');
  10.             var temp_array = [];
  11.             for (var j = 0; j < inRow + 1; j++) {
  12.                 temp_array.push(divs.eq(j).find(elem).outerHeight())
  13.             }
  14.             var maxHeight = Math.max.apply(Math, temp_array);
  15.             divs.find(elem).height(parseInt(maxHeight));
  16.         });
  17.     }
  18. }
  19.  
  20. app_shop.fn.resizeWrappers = function(obj){
  21.  
  22.  
  23.         var nr = (app_shop.vars.view === 1  ? 1: 3);
  24.  
  25.         obj.each(function(){
  26.             productHeights(nr , $(this), ['.search_product_producer', '.product-name', '.product-firm', 'div.product_prices']);
  27.         });  
  28.  
  29. }
  30.  
  31. app_shop.run(function(){
  32.  
  33.     console.log('resizeWrappers - start');
  34. app_shop.fn.resizeWrappers($('#search'));
  35. console.log('resizeWrappers - end');
  36.  
  37. }, [1,2,3,4]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement