Team:UCLA/anuved verma ucla2014 workspace/Javascript

From 2014.igem.org

(Difference between revisions)
Line 165: Line 165:
 +
    var total = $('.slider_imgs > td').length;
     var count = 0;
     var count = 0;
     $('.slider_left').click(function(){
     $('.slider_left').click(function(){
         if(count > 0){
         if(count > 0){
             $('.slider_imgs').stop(true,true).animate({ left: '+=500px'}, 250);
             $('.slider_imgs').stop(true,true).animate({ left: '+=500px'}, 250);
-
             count += 1;
+
             count -= 1;
         } else{
         } else{
             $('.slider_imgs').stop(true,true).animate({ left: '+=20px'}, 100, function(){$('.slider_imgs').stop(true,true).animate({ left: '-=20px'}, 500)});
             $('.slider_imgs').stop(true,true).animate({ left: '+=20px'}, 100, function(){$('.slider_imgs').stop(true,true).animate({ left: '-=20px'}, 500)});
Line 175: Line 176:
     });
     });
     $('.slider_right').click(function(){
     $('.slider_right').click(function(){
-
          $('.slider_imgs').stop(true,true).animate({ left: '-=500px'}, 250);
+
        if(count < total){
 +
            $('.slider_imgs').stop(true,true).animate({ left: '-=500px'}, 250);
 +
            count += 1;
 +
        } else{
 +
            $('.slider_imgs').stop(true,true).animate({ left: '+=1500px'}, 250);
 +
            count = 0'
 +
        }
     });
     });
   });
   });

Revision as of 08:03, 20 September 2014