Advertisement
Guest User

Untitled

a guest
Jun 25th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.   function imageScrollBox()
  3.   {
  4.     if ($('#main .product-images li').length > 12) {
  5.         $('.scroll-box-arrows').show();
  6.  
  7.         var visible_cols = 6;
  8.         var rows = 2;
  9.         var max = (((($('#main .product-images li').length/2)*75)/rows)*-1) + 75 * visible_cols;
  10.        
  11.         $('.scroll-box-arrows .right').click(function () {
  12.             console.log('Click');
  13.             if(parseInt($('#main .product-images').css('margin-left'),10) > max)
  14.             {
  15.                 console.log('True');
  16.                 $('#main .product-images').animate({marginLeft: "-=75px"}, 500);
  17.             }
  18.         });
  19.         $('.scroll-box-arrows .left').click(function () {
  20.             console.log('Click');
  21.             if(parseInt($('#main .product-images').css('margin-left'), 10) < 0)
  22.             {
  23.                 console.log('True');
  24.                 $('#main .product-images').animate({marginLeft: "+=75px"}, 500);
  25.             }
  26.         });
  27.        
  28.         if(parseInt($('#main .product-images').css('margin-left')) == '0px')
  29.         {
  30.             $('.scroll-box-arrows .left').hide();
  31.         }else{
  32.             $('.scroll-box-arrows .left').show();
  33.         }
  34.        
  35.         if(parseInt($('#main .product-images').css('margin-left')) >= (((($('#main .product-images li').length/2)/2)+($('#main .product-images li').length/2)%2)-6) * -75)
  36.         {
  37.             $('.scroll-box-arrows .right').hide();
  38.         }else{
  39.             $('.scroll-box-arrows .right').show();
  40.         }
  41.        
  42.     } else {
  43.         $('.scroll-box-arrows').hide();
  44.     }
  45.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement