Team:LMU-Munich/Templates/Page Footer
From 2012.igem.org
(Difference between revisions)
(finally a use for the footer :-D) |
|||
(11 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
+ | <html> | ||
+ | <div style="clear:both"></div> | ||
</div> | </div> | ||
+ | |||
+ | <script type="text/javascript"> | ||
+ | var divs = document.getElementsByTagName("div"); | ||
+ | for(var i = 0; i < divs.length; ++i) { | ||
+ | var slideshow2 = divs[i]; | ||
+ | if(slideshow2.getAttribute("class") != "slideshow") { | ||
+ | continue; | ||
+ | } | ||
+ | |||
+ | var x = function() { | ||
+ | var slideshow = slideshow2; | ||
+ | |||
+ | slideshow.lis = slideshow.getElementsByTagName("li"); | ||
+ | slideshow.current_li = 0; | ||
+ | slideshow.next_li = 1; | ||
+ | slideshow.time = 1.; | ||
+ | slideshow.timeout = null; | ||
+ | slideshow.fast = false; | ||
+ | |||
+ | slideshow.set_timeout = function(timeout, callback) { | ||
+ | if(slideshow.timeout != null) { | ||
+ | window.clearTimeout(slideshow.timeout); | ||
+ | } | ||
+ | slideshow.last_time = (new Date()).getTime(); | ||
+ | slideshow.timeout = window.setTimeout(callback, timeout); | ||
+ | } | ||
+ | |||
+ | slideshow.timestep = function() { | ||
+ | if(slideshow.time == 0) { | ||
+ | dt = 20; | ||
+ | } else { | ||
+ | var time = (new Date()).getTime(); | ||
+ | var dt = time - slideshow.last_time; | ||
+ | slideshow.last_time = time; | ||
+ | } | ||
+ | slideshow.time += dt / (slideshow.fast ? 1000. : 3000.); | ||
+ | if(slideshow.time >= 1.) { | ||
+ | slideshow.time = 1.; | ||
+ | } | ||
+ | var anim_time = .5 - .5 * Math.cos(slideshow.time * 3.141); | ||
+ | slideshow.lis[slideshow.current_li].style.left = anim_time * -100 + "%"; | ||
+ | slideshow.lis[slideshow.next_li].style.left = (1. - anim_time) * 100 + "%"; | ||
+ | |||
+ | if(slideshow.time >= 1.) { | ||
+ | // slideshow.lis[slideshow.current_li].style.display = "none"; | ||
+ | slideshow.current_li = slideshow.next_li; | ||
+ | slideshow.next_li = slideshow.next_li + 1 >= slideshow.lis.length ? 0 : slideshow.next_li + 1; | ||
+ | slideshow.time = 0; | ||
+ | slideshow.fast = false; | ||
+ | // alert(slideshow.next_li); | ||
+ | // alert(slideshow.current_li); | ||
+ | slideshow.set_timeout(5000, slideshow.timestep); | ||
+ | // slideshow.lis[slideshow.next_li].style.display = "block"; | ||
+ | // slideshow.lis[slideshow.next_li].z_index = "2"; | ||
+ | // slideshow.lis[slideshow.current_li].z_index = "1"; | ||
+ | } else { | ||
+ | slideshow.set_timeout(20, slideshow.timestep); | ||
+ | } | ||
+ | var antilink = document.createElement("div"); | ||
+ | antilink.setAttribute("class", "antilink"); | ||
+ | slideshow.appendChild(antilink); | ||
+ | var div = document.createElement("div"); | ||
+ | div.setAttribute("class", "next"); | ||
+ | slideshow.appendChild(div); | ||
+ | div.onclick = function() { | ||
+ | slideshow.set_timeout(0, slideshow.timestep); | ||
+ | slideshow.fast = true; | ||
+ | } | ||
+ | |||
+ | }; | ||
+ | |||
+ | slideshow.set_timeout(0, slideshow.timestep); | ||
+ | }(); | ||
+ | } | ||
+ | </script> | ||
+ | |||
+ | </html> |
Latest revision as of 11:07, 8 September 2012