Team:University College London/js/radio
From 2012.igem.org
(Difference between revisions)
Line 1: | Line 1: | ||
$(document).ready(function(){ | $(document).ready(function(){ | ||
+ | $('.episode').click(function(){ | ||
+ | |||
+ | window.location = "https://2012.igem.org/Team:University_College_London/gemFM/"+$(this).attr(title); | ||
+ | }); | ||
+ | |||
var episodes = $('#slidecontainer').children(); | var episodes = $('#slidecontainer').children(); | ||
episodes.first().animate({opacity:1},2); | episodes.first().animate({opacity:1},2); |
Revision as of 16:33, 15 August 2012
$(document).ready(function(){
$('.episode').click(function(){ window.location = "https://2012.igem.org/Team:University_College_London/gemFM/"+$(this).attr(title); }); var episodes = $('#slidecontainer').children(); episodes.first().animate({opacity:1},2);
var currentEpisode = episodes.first(); var currI = 0;
function animateEpisodeIn(){ currentEpisode.find('.bg').animate({left:'0px',opacity:0.8},800,"easeInCubic",function(){ currentEpisode.find('.desc').animate({opacity:1},1000,function(){ var nextEpisode = currentEpisode.next(); currI += 1; if(currI == episodes.length){ nextEpisode = episodes.first(); currI = 0; }
nextEpisode.find('.bg').animate({left:'-728px',opacity:0},2); nextEpisode.find('.desc').animate({opacity:0},2);
window.setTimeout(function() {
nextEpisode.animate({left:'728px'},2).show().animate({opacity:1},1).animate({left:'0px'},1000,"easeInOutCubic"); currentEpisode.delay(3).animate({left:'-728px'},1000,"easeInOutCubic").animate({opacity:0},2,function(){
currentEpisode = nextEpisode; animateEpisodeIn(); }); }, 5000);
}); }); }
animateEpisodeIn();
});