Team:Heidelberg/Templates/carousel-special-js2
From 2013.igem.org
(Difference between revisions)
Nils.kurzawa (Talk | contribs) m (Created page with "//stop carousel running automatically $('#myCarousel').carousel({interval: 0}).on('slide.bs.carousel', function(e) { var active_month ...") |
JuliaS1992 (Talk | contribs) |
||
(12 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
//stop carousel running automatically | //stop carousel running automatically | ||
- | + | $(function(){ | |
- | + | $('#myCarousel').carousel({interval: 0}).on('slide.bs.carousel', function(e) { | |
- | + | var active_month = $('.month_tab.active'); | |
- | + | var prev_month = $('.month_tab.active').prev(); | |
+ | var next_month = $('.month_tab.active').next(); | ||
- | + | if ($('.item:visible').hasClass('first') == true && $('.item:visible').hasClass('may') == false) { | |
- | + | if (e.direction == "right") { | |
- | + | active_month.removeClass('active'); | |
- | + | prev_month.addClass('active'); | |
- | + | } | |
- | + | } | |
- | + | if ($('.item:visible').hasClass('first') == true && $('.item:visible').hasClass('may') == true) { | |
- | + | if (e.direction == "right") { | |
- | + | active_month.removeClass('active'); | |
- | + | $($('.item:visible').hasClass('october')).addClass('active'); | |
- | + | $($('.month_tab').show().slice(0,3)).hide(); | |
- | + | $('#october').addClass('active'); | |
+ | $('.labjournal-weekly:visible').hide(); | ||
+ | $($('.labjournal-weekly')[22]).show(); | ||
- | + | } | |
- | + | } | |
if ($('.item:visible').hasClass('last') == true && $('.item:visible').hasClass('october') == false){ | if ($('.item:visible').hasClass('last') == true && $('.item:visible').hasClass('october') == false){ | ||
if (e.direction == "left") { | if (e.direction == "left") { | ||
Line 31: | Line 34: | ||
if (e.direction == "left") { | if (e.direction == "left") { | ||
active_month.removeClass('active'); | active_month.removeClass('active'); | ||
- | $($('.item:visible').hasClass(' | + | $($('.item:visible').hasClass('may')).addClass('active'); |
+ | $($('.month_tab').show().slice(3)).hide(); | ||
+ | $('#may').addClass('active'); | ||
$('.labjournal-weekly:visible').hide(); | $('.labjournal-weekly:visible').hide(); | ||
$($('.labjournal-weekly')[0]).show(); | $($('.labjournal-weekly')[0]).show(); | ||
Line 48: | Line 53: | ||
}); | }); | ||
$($('.labjournal-weekly').hide()[0]).show(); | $($('.labjournal-weekly').hide()[0]).show(); | ||
+ | }); |
Latest revision as of 23:46, 28 October 2013
//stop carousel running automatically $(function(){
$('#myCarousel').carousel({interval: 0}).on('slide.bs.carousel', function(e) { var active_month = $('.month_tab.active'); var prev_month = $('.month_tab.active').prev(); var next_month = $('.month_tab.active').next();
if ($('.item:visible').hasClass('first') == true && $('.item:visible').hasClass('may') == false) { if (e.direction == "right") { active_month.removeClass('active'); prev_month.addClass('active');
} } if ($('.item:visible').hasClass('first') == true && $('.item:visible').hasClass('may') == true) { if (e.direction == "right") { active_month.removeClass('active'); $($('.item:visible').hasClass('october')).addClass('active'); $($('.month_tab').show().slice(0,3)).hide(); $('#october').addClass('active'); $('.labjournal-weekly:visible').hide(); $($('.labjournal-weekly')[22]).show();
} } if ($('.item:visible').hasClass('last') == true && $('.item:visible').hasClass('october') == false){ if (e.direction == "left") { active_month.removeClass('active'); next_month.addClass('active'); }
} if ($('.item:visible').hasClass('last') == true && $('.item:visible').hasClass('october') == true){ if (e.direction == "left") { active_month.removeClass('active'); $($('.item:visible').hasClass('may')).addClass('active'); $($('.month_tab').show().slice(3)).hide(); $('#may').addClass('active'); $('.labjournal-weekly:visible').hide(); $($('.labjournal-weekly')[0]).show(); }
}
var current = $('.labjournal-weekly:visible'); current.hide(); if (e.direction == "left") { current.next().show(); } else { current.prev().show(); } }); $($('.labjournal-weekly').hide()[0]).show();
});