Team:UCLA/Template/Javascript
From 2014.igem.org
(Difference between revisions)
Anuvedverma (Talk | contribs) |
Anuvedverma (Talk | contribs) |
||
Line 185: | Line 185: | ||
} else{ | } else{ | ||
$('.slider_imgs').stop(true,true).animate({ left: '+=3450px'}, 250); | $('.slider_imgs').stop(true,true).animate({ left: '+=3450px'}, 250); | ||
+ | count = 0; | ||
+ | } | ||
+ | }); | ||
+ | }); | ||
+ | </script> | ||
+ | |||
+ | |||
+ | <!--HP SLIDER--> | ||
+ | <script type="text/javascript"> | ||
+ | $(document).ready(function() { | ||
+ | $('.hpslider_left').mouseenter(function(){ | ||
+ | $('.hpslider_left').animate({ opacity: '0.8'},1); | ||
+ | }); | ||
+ | $('.hpslider_right').mouseenter(function(){ | ||
+ | $('.hpslider_right').animate({ opacity: '0.8'},1); | ||
+ | }); | ||
+ | $('.hpslider_left').mouseleave(function(){ | ||
+ | $('.hpslider_left').animate({ opacity: '0.5'},1); | ||
+ | }); | ||
+ | $('.hpslider_right').mouseleave(function(){ | ||
+ | $('.hpslider_right').animate({ opacity: '0.5'},1); | ||
+ | }); | ||
+ | |||
+ | |||
+ | var total = $('.hpslider_imgs > td').length; | ||
+ | var count = 0; | ||
+ | $('.hpslider_left').click(function(){ | ||
+ | if(count > 0){ | ||
+ | $('.hpslider_imgs').stop(true,true).animate({ left: '+=1150px'}, 250); | ||
+ | count -= 1; | ||
+ | } else{ | ||
+ | $('.hpslider_imgs').stop(true,true).animate({ left: '+=20px'}, 100, function(){$('.hpslider_imgs').stop(true,true).animate({ left: '-=20px'}, 500)}); | ||
+ | } | ||
+ | }); | ||
+ | $('.hpslider_right').click(function(){ | ||
+ | if(count < 2){ | ||
+ | $('.hpslider_imgs').stop(true,true).animate({ left: '-=1150px'}, 250); | ||
+ | count += 1; | ||
+ | } else{ | ||
+ | $('.hpslider_imgs').stop(true,true).animate({ left: '+=2300px'}, 250); | ||
count = 0; | count = 0; | ||
} | } |
Revision as of 11:03, 17 October 2014