Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function imageScrollBox()
- {
- if ($('#main .product-images li').length > 12) {
- $('.scroll-box-arrows').show();
- var visible_cols = 6;
- var rows = 2;
- var max = (((($('#main .product-images li').length/2)*75)/rows)*-1) + 75 * visible_cols;
- $('.scroll-box-arrows .right').click(function () {
- console.log('Click');
- if(parseInt($('#main .product-images').css('margin-left'),10) > max)
- {
- console.log('True');
- $('#main .product-images').animate({marginLeft: "-=75px"}, 500);
- }
- });
- $('.scroll-box-arrows .left').click(function () {
- console.log('Click');
- if(parseInt($('#main .product-images').css('margin-left'), 10) < 0)
- {
- console.log('True');
- $('#main .product-images').animate({marginLeft: "+=75px"}, 500);
- }
- });
- if(parseInt($('#main .product-images').css('margin-left')) == '0px')
- {
- $('.scroll-box-arrows .left').hide();
- }else{
- $('.scroll-box-arrows .left').show();
- }
- if(parseInt($('#main .product-images').css('margin-left')) >= (((($('#main .product-images li').length/2)/2)+($('#main .product-images li').length/2)%2)-6) * -75)
- {
- $('.scroll-box-arrows .right').hide();
- }else{
- $('.scroll-box-arrows .right').show();
- }
- } else {
- $('.scroll-box-arrows').hide();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement