Template:Team:UNAM Genomics Mexico/Templates/menulike
From 2012.igem.org
(Difference between revisions)
Line 1,480: | Line 1,480: | ||
}); | }); | ||
</script> | </script> | ||
+ | <script> | ||
+ | var $slider_started = false; | ||
+ | $(document).ready(function(){ | ||
+ | var $total_slider = $('.top-slider-main > div').length; | ||
+ | var $label_width = $('.top-slider-main div .left').width(); | ||
+ | var $max_slider_width = ($total_slider -1)*$label_width; | ||
+ | var $extra_margin = $('.top-slider-main div').width() - $label_width; | ||
+ | $('.top-slider-main div:not(.slider-box1) .left').mouseover(function(){ | ||
+ | var $slider_index = $('.top-slider-main > div').index($(this).parent()) + 1; | ||
+ | if($(this).parent().hasClass('on')) | ||
+ | { | ||
+ | if($slider_started != 1) | ||
+ | { | ||
+ | $slider_started = 2; | ||
+ | for(i=$total_slider; i>=$slider_index; i--) | ||
+ | { | ||
+ | var $elm = $('.top-slider-main .slider-box'+i); | ||
+ | if($elm.hasClass('on')) | ||
+ | { | ||
+ | $elm.removeClass('on'); | ||
+ | var $left_margin = ($label_width*(i-1)) + $extra_margin; | ||
+ | $elm.stop().animate({marginLeft : $left_margin}, 1500, function(){$slider_started = false;}); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | if($slider_started != 2) | ||
+ | { | ||
+ | $slider_started = 1; | ||
+ | for(i=2; i<=$slider_index; i++) | ||
+ | { | ||
+ | var $elm = $('.top-slider-main .slider-box'+i); | ||
+ | if(!$elm.hasClass('on')) | ||
+ | { | ||
+ | $elm.addClass('on'); | ||
+ | var $left_margin = ($label_width*(i-1)); | ||
+ | $elm.stop().animate({marginLeft : $left_margin}, 1500, function(){$slider_started = false;}); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }); | ||
+ | }); | ||
+ | </script> | ||
</html> | </html> |
Revision as of 04:38, 16 September 2012