Team:University College London/js/radio
From 2012.igem.org
(Difference between revisions)
(9 intermediate revisions not shown) | |||
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().show().animate({opacity:1},2); |
var currentEpisode = episodes.first(); | var currentEpisode = episodes.first(); | ||
Line 7: | Line 14: | ||
function animateEpisodeIn(){ | function animateEpisodeIn(){ | ||
- | currentEpisode.find('.bg').animate({ | + | currentEpisode.find('.bg').css("display","block").animate({left:'0px',opacity:0.8},800,"easeInCubic",function(){ |
currentEpisode.find('.desc').animate({opacity:1},1000,function(){ | currentEpisode.find('.desc').animate({opacity:1},1000,function(){ | ||
var nextEpisode = currentEpisode.next(); | var nextEpisode = currentEpisode.next(); | ||
Line 15: | Line 22: | ||
currI = 0; | currI = 0; | ||
} | } | ||
- | nextEpisode.find('.bg').animate({ | + | nextEpisode.find('.bg').animate({left:'-728px',opacity:0},2); |
nextEpisode.find('.desc').animate({opacity:0},2); | nextEpisode.find('.desc').animate({opacity:0},2); | ||
window.setTimeout(function() { | window.setTimeout(function() { | ||
- | nextEpisode.animate({left:'728px'},2).show().animate({opacity:1},1).animate({left:'0px'}, | + | nextEpisode.animate({left:'728px'},2).show().animate({opacity:1},1).animate({left:'0px'},1000,"easeInOutCubic"); |
- | currentEpisode.animate({left:'-728px'},1000,"easeInOutCubic").animate({opacity:0},2,function(){ | + | currentEpisode.delay(3).animate({left:'-728px'},1000,"easeInOutCubic").animate({opacity:0},2,function(){ |
currentEpisode = nextEpisode; animateEpisodeIn(); | currentEpisode = nextEpisode; animateEpisodeIn(); |
Latest revision as of 07:45, 16 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().show().animate({opacity:1},2);
var currentEpisode = episodes.first(); var currI = 0;
function animateEpisodeIn(){ currentEpisode.find('.bg').css("display","block").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();
});