Team:LMU-Munich/Templates/Page Footer

From 2012.igem.org

(Difference between revisions)
 
(6 intermediate revisions not shown)
Line 6: Line 6:
var divs = document.getElementsByTagName("div");
var divs = document.getElementsByTagName("div");
for(var i = 0; i < divs.length; ++i) {
for(var i = 0; i < divs.length; ++i) {
-
var slideshow = divs[i];
+
var slideshow2 = divs[i];
-
if(slideshow.getAttribute("class") != "slideshow") {
+
if(slideshow2.getAttribute("class") != "slideshow") {
continue;
continue;
}
}
-
slideshow.lis = slideshow.getElementsByTagName("li");
+
var x = function() {
-
alert(slideshow.lis);
+
var slideshow = slideshow2;
-
slideshow.current_li = 0;
+
-
slideshow.next_li = 1;
+
-
slideshow.time = 1.;
+
-
slideshow.timeout = null;
+
-
slideshow.fast = false;
+
-
slideshow.set_timeout = function(timeout, callback) {
+
slideshow.lis = slideshow.getElementsByTagName("li");
-
if(slideshow.timeout != null) {
+
slideshow.current_li = 0;
-
window.clearTimeout(slideshow.timeout);
+
slideshow.next_li = 1;
-
}
+
slideshow.time = 1.;
-
slideshow.last_time = (new Date()).getTime();
+
slideshow.timeout = null;
-
slideshow.timeout = window.setTimeout(callback, timeout);
+
slideshow.fast = false;
-
}
+
-
slideshow.timestep = function() {
+
slideshow.set_timeout = function(timeout, callback) {
-
if(slideshow.time == 0) {
+
if(slideshow.timeout != null) {
-
dt = 20;
+
window.clearTimeout(slideshow.timeout);
-
} else {
+
}
-
var time = (new Date()).getTime();
+
slideshow.last_time = (new Date()).getTime();
-
var dt = time - slideshow.last_time;
+
slideshow.timeout = window.setTimeout(callback, timeout);
-
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.timestep = function() {
-
// slideshow.lis[slideshow.current_li].style.display = "none";
+
if(slideshow.time == 0) {
-
slideshow.current_li = slideshow.next_li;
+
dt = 20;
-
slideshow.next_li = slideshow.next_li + 1 >= slideshow.lis.length ? 0 : slideshow.next_li + 1;
+
} else {
-
slideshow.time = 0;
+
var time = (new Date()).getTime();
-
slideshow.fast = false;
+
var dt = time - slideshow.last_time;
-
// alert(slideshow.next_li);
+
slideshow.last_time = time;
-
// alert(slideshow.current_li);
+
}
-
slideshow.set_timeout(5000, slideshow.timestep);
+
slideshow.time += dt / (slideshow.fast ? 1000. : 3000.);
-
// slideshow.lis[slideshow.next_li].style.display = "block";
+
if(slideshow.time >= 1.) {
-
// slideshow.lis[slideshow.next_li].z_index = "2";
+
slideshow.time = 1.;
-
// slideshow.lis[slideshow.current_li].z_index = "1";
+
}
-
} else {
+
var anim_time = .5 - .5 * Math.cos(slideshow.time * 3.141);
-
slideshow.set_timeout(20, slideshow.timestep);
+
slideshow.lis[slideshow.current_li].style.left = anim_time * -100 + "%";
-
}
+
slideshow.lis[slideshow.next_li].style.left = (1. - anim_time) * 100 + "%";
-
var antilink = document.createElement("div");
+
 
-
antilink.setAttribute("class", "antilink");
+
if(slideshow.time >= 1.) {
-
slideshow.appendChild(antilink);
+
// slideshow.lis[slideshow.current_li].style.display = "none";
-
var div = document.createElement("div");
+
slideshow.current_li = slideshow.next_li;
-
div.setAttribute("class", "next");
+
slideshow.next_li = slideshow.next_li + 1 >= slideshow.lis.length ? 0 : slideshow.next_li + 1;
-
slideshow.appendChild(div);
+
slideshow.time = 0;
-
div.onclick = function() {
+
slideshow.fast = false;
-
slideshow.set_timeout(0, slideshow.timestep);
+
// alert(slideshow.next_li);
-
slideshow.fast = true;
+
// 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);
+
slideshow.set_timeout(0, slideshow.timestep);
 +
}();
}
}
</script>
</script>
</html>
</html>

Latest revision as of 11:07, 8 September 2012