Team:UNIK Copenhagen
From 2013.igem.org
SigneKarlsen (Talk | contribs) |
SigneKarlsen (Talk | contribs) |
||
(45 intermediate revisions not shown) | |||
Line 2: | Line 2: | ||
</body> | </body> | ||
<head> | <head> | ||
- | <link rel="image_src" href="https://static.igem.org/mediawiki/2013/ | + | <link rel="image_src" href="https://static.igem.org/mediawiki/2013/c/c3/UNIK_Copenhagen_Facebook_Thumbnail.jpg" /> |
</head> | </head> | ||
</html> | </html> | ||
Line 113: | Line 113: | ||
float: left; | float: left; | ||
} | } | ||
- | #slide_video | + | #slide_video{ |
- | + | background: url("https://static.igem.org/mediawiki/2013/3/31/UNIK_Copenhagen_iGEM_the_wheel.png"); | |
- | + | background-repeat: no-repeat; | |
- | + | ||
- | + | ||
} | } | ||
#vid{ | #vid{ | ||
margin: 15px; | margin: 15px; | ||
float: right; | float: right; | ||
- | z-index: | + | } |
+ | #vid iframe{ | ||
+ | z-index: 100; | ||
} | } | ||
#vid_text{ | #vid_text{ | ||
Line 202: | Line 202: | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
- | |||
- | |||
var slidePos = 0; | var slidePos = 0; | ||
var Width = 935; | var Width = 935; | ||
Line 209: | Line 207: | ||
var pauseTime = 5000; | var pauseTime = 5000; | ||
var numPictures = 4; | var numPictures = 4; | ||
+ | var pauseSlider = false; | ||
+ | var youTubePlaying = false; | ||
+ | |||
+ | $(document).ready(function(){ | ||
+ | |||
+ | |||
function slide(targetSlide, par_function){ | function slide(targetSlide, par_function){ | ||
- | + | ||
var new_left = Width * targetSlide *-1; | var new_left = Width * targetSlide *-1; | ||
Line 218: | Line 222: | ||
//left: '-='+slideDistance | //left: '-='+slideDistance | ||
}, animationTime, 'linear', function(){ | }, animationTime, 'linear', function(){ | ||
- | if(par_function != undefined) par_function(); | + | if(par_function != undefined) par_function(); |
- | }); | + | }); |
} | } | ||
Line 225: | Line 229: | ||
function set_interval(){ | function set_interval(){ | ||
interval = window.setInterval(function(){ | interval = window.setInterval(function(){ | ||
+ | if(pauseSlider || youTubePlaying) | ||
+ | return; | ||
slide(slidePos); | slide(slidePos); | ||
slidePos++; | slidePos++; | ||
Line 234: | Line 240: | ||
set_interval(); | set_interval(); | ||
- | + | ||
$('#subcontainer').mouseover(function(){ | $('#subcontainer').mouseover(function(){ | ||
- | window.clearInterval(interval); | + | //window.clearInterval(interval); |
+ | pauseSlider = true; | ||
}).mouseout(function(){ | }).mouseout(function(){ | ||
- | set_interval(); | + | pauseSlider = false; |
+ | //set_interval(); | ||
}); | }); | ||
- | |||
- | |||
- | |||
- | |||
- | |||
function nextSlide(){ | function nextSlide(){ | ||
- | window.clearInterval(interval); | + | window.clearInterval(interval); |
//var num_slide = slidePos+1; | //var num_slide = slidePos+1; | ||
- | slidePos++; | + | slidePos++; |
if(slidePos == numPictures) | if(slidePos == numPictures) | ||
slidePos = 0; | slidePos = 0; | ||
Line 256: | Line 259: | ||
function prevSlide(){ | function prevSlide(){ | ||
- | window.clearInterval(interval); | + | window.clearInterval(interval); |
slidePos--; | slidePos--; | ||
if(slidePos == -1) | if(slidePos == -1) | ||
Line 304: | Line 307: | ||
<h3><span>Watch our video</span><br> | <h3><span>Watch our video</span><br> | ||
<span>Learn about our project</span></h3></div> | <span>Learn about our project</span></h3></div> | ||
- | + | <!-- <div id="vid"> | |
<iframe width="480" height="300" src="//www.youtube.com/embed/Y6xQG2dA0tA?feature=player_detailpage&wmode=opaque" frameborder="0" allowfullscreen></iframe> | <iframe width="480" height="300" src="//www.youtube.com/embed/Y6xQG2dA0tA?feature=player_detailpage&wmode=opaque" frameborder="0" allowfullscreen></iframe> | ||
</div> | </div> | ||
- | + | --> | |
+ | <div id="vid"></div> | ||
+ | <script> | ||
+ | // 2. This code loads the IFrame Player API code asynchronously. | ||
+ | var tag = document.createElement('script'); | ||
+ | |||
+ | tag.src = "https://www.youtube.com/iframe_api"; | ||
+ | var firstScriptTag = document.getElementsByTagName('script')[0]; | ||
+ | firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); | ||
+ | |||
+ | // 3. This function creates an <iframe> (and YouTube player) | ||
+ | // after the API code downloads. | ||
+ | var player; | ||
+ | function onYouTubeIframeAPIReady() { | ||
+ | player = new YT.Player('vid', { | ||
+ | height: '300', | ||
+ | width: '480', | ||
+ | videoId: 'Y6xQG2dA0tA', | ||
+ | playerVars: { | ||
+ | wmode: "opaque" | ||
+ | }, | ||
+ | events: { | ||
+ | 'onReady': onPlayerReady, | ||
+ | 'onStateChange': onPlayerStateChange | ||
+ | } | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | // 4. The API will call this function when the video player is ready. | ||
+ | function onPlayerReady(event) { | ||
+ | //event.target.playVideo(); | ||
+ | } | ||
+ | |||
+ | // 5. The API calls this function when the player's state changes. | ||
+ | // The function indicates that when playing a video (state=1), | ||
+ | // the player should play for six seconds and then stop. | ||
+ | function onPlayerStateChange(event) { | ||
+ | if (event.data == YT.PlayerState.PLAYING) { | ||
+ | youTubePlaying = true; | ||
+ | } else{ | ||
+ | youTubePlaying = false; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | </script> | ||
+ | |||
+ | |||
+ | |||
</div> | </div> | ||
</li> | </li> | ||
</ul> | </ul> | ||
</div> | </div> | ||
- | |||
- | |||
- | |||
</div> | </div> | ||
- | < | + | <br> |
- | + | ||
<div id="line"></div> | <div id="line"></div> | ||
<div id="four_photos"> | <div id="four_photos"> |
Latest revision as of 18:45, 3 October 2013