Team:Goettingen/suplement/scripts
From 2013.igem.org
m |
m |
||
Line 1: | Line 1: | ||
- | function | + | function showDro(ob){ |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
+ | var sib = ob.nextElementSibling || getNextElementSibling(ob); | ||
+ | var par = ob.parentElement; | ||
+ | |||
+ | |||
+ | //alert(sib); | ||
+ | sib.style.top = calDefTop(par) + par.clientHeight + 'px'; | ||
+ | sib.style.left = ob.offsetLeft + 'px'; | ||
+ | |||
+ | sib.style.display = 'block'; | ||
+ | ob.style.backgroundColor = '#8f0000';ob.style.color = 'white'; | ||
+ | sib.onmouseover = function(){sib.style.display = 'block';ob.style.backgroundColor = '#8f0000';ob.style.color = 'white';} | ||
+ | sib.onmouseout = function(){sib.style.display = 'none';ob.style.backgroundColor ='';ob.style.color = '';} | ||
+ | ob.onmouseout = function(){sib.style.display = 'none';ob.style.backgroundColor ='';ob.style.color = '';} | ||
+ | |||
+ | |||
+ | } | ||
+ | |||
+ | function getOrgStyle(ob){ | ||
+ | var bkgc = window.getComputedStyle(ob,null).backgroundColor; | ||
+ | var color = window.getComputedStyle(ob,null).color; | ||
+ | var elm = {'backgroundColor':bkgc,'color':color} | ||
+ | return elm; | ||
+ | } | ||
+ | |||
+ | //4 slides | ||
function fadeInOut() | function fadeInOut() | ||
{ | { | ||
$("#slide").fadeOut(300,function(){ | $("#slide").fadeOut(300,function(){ | ||
- | i | + | //alert(i); |
document.getElementById("slide").src=e[i]; | document.getElementById("slide").src=e[i]; | ||
- | + | document.getElementById("slide-a").href = link[i]; | |
+ | i++; | ||
$("#slide").fadeIn(300,slide_ctrl()); | $("#slide").fadeIn(300,slide_ctrl()); | ||
}); | }); | ||
Line 29: | Line 42: | ||
- | function | + | function startslide() |
{ | { | ||
- | |||
fadeInOut(); | fadeInOut(); | ||
- | |||
$("#resume").hide(); | $("#resume").hide(); | ||
$("#stop").show(); | $("#stop").show(); | ||
if(i >= 3) i = 0; | if(i >= 3) i = 0; | ||
- | timer = setTimeout(" | + | timer = setTimeout("startslide()",5000); |
}; | }; | ||
- | function | + | function stopslide() |
{ | { | ||
clearTimeout(timer); | clearTimeout(timer); | ||
- | |||
$("#pause").hide(); | $("#pause").hide(); | ||
$("#resume").show(); | $("#resume").show(); | ||
Line 51: | Line 61: | ||
function go2right(){ | function go2right(){ | ||
- | + | fadeInOut(); | |
- | + | ||
} | } | ||
function slide_ctrl(){ | function slide_ctrl(){ | ||
var x = 0; | var x = 0; | ||
- | var text = '<span id="slide-ctrl-1" | + | var text = '<span id="slide-ctrl-1">'; |
for(x=0;x<=2;x++){ | for(x=0;x<=2;x++){ | ||
if (x==(i-1)) { text += '<img src="https://static.igem.org/mediawiki/2013/9/9d/Goe-this.png" />' ;} | if (x==(i-1)) { text += '<img src="https://static.igem.org/mediawiki/2013/9/9d/Goe-this.png" />' ;} | ||
- | else { text += '<img src="https://static.igem.org/mediawiki/2013/4/4c/Goe-notThis.png" onclick="i = ' + x + '; | + | else { text += '<img src="https://static.igem.org/mediawiki/2013/4/4c/Goe-notThis.png" onclick="i = ' + x + ';stopslide(); startslide()" />';} |
}; | }; | ||
- | text += ' | + | text += '</span>'; |
- | text += '<img src="https://static.igem.org/mediawiki/2013/b/b6/Goe-pause.png" alt="pause" id="pause" onclick=" | + | text += '<img src="https://static.igem.org/mediawiki/2013/b/b6/Goe-pause.png" alt="pause" id="pause" onclick="stopslide()" /><img src="https://static.igem.org/mediawiki/2013/b/b1/Goe-resume.png" alt="resume" id="resume" onclick="startslide()" style="display:none" />'; |
- | + | ||
- | + | ||
document.getElementById("slide-ctrl").innerHTML = text; | document.getElementById("slide-ctrl").innerHTML = text; | ||
} | } | ||
Line 74: | Line 82: | ||
i = i - 2; | i = i - 2; | ||
if (i < 0) i =2; | if (i < 0) i =2; | ||
- | + | fadeInOut(); | |
} | } | ||
Line 98: | Line 106: | ||
} | } | ||
+ | function calDefLeft(ob){ | ||
+ | var dLeft = 0; | ||
+ | while( ob != null){ | ||
+ | dLeft += ob.offsetLeft; | ||
+ | //ob.innerHTML += dTop+ ' '; | ||
+ | ob = ob.offsetParent;} | ||
+ | return dLeft; | ||
+ | } | ||
$(document).ready(function(){ | $(document).ready(function(){ | ||
Line 111: | Line 127: | ||
}); | }); | ||
ob1 = document.getElementById('col-left'); | ob1 = document.getElementById('col-left'); | ||
- | rTop = 307; | + | // rTop = 307; |
- | window.setInterval('fixedpo()',20); | + | //window.setInterval('fixedpo()',20); |
}) | }) |
Revision as of 18:44, 24 June 2013
function showDro(ob){
var sib = ob.nextElementSibling || getNextElementSibling(ob); var par = ob.parentElement;
//alert(sib);
sib.style.top = calDefTop(par) + par.clientHeight + 'px';
sib.style.left = ob.offsetLeft + 'px';
sib.style.display = 'block'; ob.style.backgroundColor = '#8f0000';ob.style.color = 'white'; sib.onmouseover = function(){sib.style.display = 'block';ob.style.backgroundColor = '#8f0000';ob.style.color = 'white';} sib.onmouseout = function(){sib.style.display = 'none';ob.style.backgroundColor =;ob.style.color = ;} ob.onmouseout = function(){sib.style.display = 'none';ob.style.backgroundColor =;ob.style.color = ;}
}
function getOrgStyle(ob){ var bkgc = window.getComputedStyle(ob,null).backgroundColor; var color = window.getComputedStyle(ob,null).color; var elm = {'backgroundColor':bkgc,'color':color} return elm; }
//4 slides
function fadeInOut() { $("#slide").fadeOut(300,function(){ //alert(i); document.getElementById("slide").src=e[i]; document.getElementById("slide-a").href = link[i]; i++; $("#slide").fadeIn(300,slide_ctrl()); });
}
function startslide()
{
fadeInOut(); $("#resume").hide(); $("#stop").show(); if(i >= 3) i = 0; timer = setTimeout("startslide()",5000); };
function stopslide()
{
clearTimeout(timer);
$("#pause").hide();
$("#resume").show();
}
function go2right(){ fadeInOut(); }
function slide_ctrl(){
var x = 0;
var text = ''; for(x=0;x<=2;x++){ if (x==(i-1)) { text += '<img src="" />' ;} else { text += '<img src="" onclick="i = ' + x + ';stopslide(); startslide()" />';} }; text += ''; text += '<img src="" alt="pause" id="pause" onclick="stopslide()" /><img src="" alt="resume" id="resume" onclick="startslide()" style="display:none" />';
document.getElementById("slide-ctrl").innerHTML = text; }
function go2left(){ stoptimer(); if (i == 0) i = 3; i = i - 2; if (i < 0) i =2; fadeInOut(); }
var ob1; var rTop = 0;
function fixedpo() { var sTop = document.getElementsByTagName('body')[0].scrollTop; if(sTop > rTop) {ob1.style.position = 'fixed'; ob1.style.top = '0px';
ob1.style.width = '27%'}
else {ob1.style.position =; ob1.style.top = ;ob1.style.width = } //; }
function calDefTop(ob){ var dTop = 0; while( ob != null){ dTop += ob.offsetTop; //ob.innerHTML += dTop+ ' '; ob = ob.offsetParent;} return dTop; }
function calDefLeft(ob){ var dLeft = 0; while( ob != null){ dLeft += ob.offsetLeft; //ob.innerHTML += dTop+ ' '; ob = ob.offsetParent;} return dLeft; }
$(document).ready(function(){
//universal $(".f-larger").click(function(){ $("p").css("font-size","14pt"); }); $(".f-smaller").click(function(){ $("p").css("font-size","12pt"); }); $(".f-medium").click(function(){ $("p").css("font-size","13pt"); }); ob1 = document.getElementById('col-left'); // rTop = 307; //window.setInterval('fixedpo()',20);
})