Team:Goettingen/suplement/scripts

From 2013.igem.org

(Difference between revisions)
 
(36 intermediate revisions not shown)
Line 1: Line 1:
 +
<html>
<script>
<script>
function showDro(ob){
function showDro(ob){
Line 7: Line 8:
//alert(sib);
//alert(sib);
-
sib.style.top = calDefTop(par) + par.clientHeight + 'px';
+
sib.style.top = calDefTop(par) + par.clientHeight -1 + 'px';
sib.style.left = ob.offsetLeft + 'px';
sib.style.left = ob.offsetLeft + 'px';
Line 18: Line 19:
}
}
 +
 +
//与jq中的toggle函数相似,简化版本
 +
function toggle(target){
 +
  if(getComputedStyle(target,null).display == "none"){
 +
            target.style.display = "block"
 +
    } else {target.style.display = "none"}
 +
}
 +
 +
function getOrgStyle(ob){
function getOrgStyle(ob){
Line 31: Line 41:
{
{
$("#slide").fadeOut(300,function(){
$("#slide").fadeOut(300,function(){
-
alert(i);
+
//alert(picSlide_i);
-
document.getElementById("slide").src=e[i];
+
document.getElementById("slide").src=e[picSlide_i];
-
document.getElementById("slide-a").href = link[i];
+
document.getElementById("slide-a").href = link[picSlide_i];
-
i = i + 1;
+
picSlide_i++;
 +
                //alert(picSlide_i);
$("#slide").fadeIn(300,slide_ctrl());
$("#slide").fadeIn(300,slide_ctrl());
});
});
Line 45: Line 56:
function startslide()
function startslide()
{
{
-
 
+
if(picSlide_i >= e.length) picSlide_i = 0;
fadeInOut();
fadeInOut();
$("#resume").hide();
$("#resume").hide();
$("#stop").show();
$("#stop").show();
-
if(i >= 3) i = 0;
 
timer = setTimeout("startslide()",5000);
timer = setTimeout("startslide()",5000);
};
};
Line 68: Line 78:
     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<e.length;x++){
-
if (x==(i-1)) { text += '<img src="https://static.igem.org/mediawiki/2013/9/9d/Goe-this.png" />' ;}
+
if (x==(picSlide_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 + ';stopslide(); startslide()" />';}
+
else { text += '<img src="https://static.igem.org/mediawiki/2013/4/4c/Goe-notThis.png" onclick="picSlide_i = ' + x + ';stopslide(); startslide()" />';}
};
};
text += '</span>';
text += '</span>';
Line 80: Line 90:
function go2left(){
function go2left(){
stoptimer();
stoptimer();
-
if (i == 0) i = 3;
+
if (picSlide_i == 0) picSlide_i = 5;
-
i = i - 2;
+
picSlide_i = picSlide_i - 2;
-
if (i < 0) i =2;
+
if (picSlide_i < 0) picSlide_i =2;
fadeInOut();
fadeInOut();
}
}
Line 95: Line 105:
                         ob1.style.width = '27%'}
                         ob1.style.width = '27%'}
else {ob1.style.position =''; ob1.style.top = '';ob1.style.width = ''}
else {ob1.style.position =''; ob1.style.top = '';ob1.style.width = ''}
-
//;
+
 +
 
 +
 
}
}
Line 116: Line 128:
}
}
-
$(document).ready(function(){
+
 
-
     //universal
+
function illus(object,name,text){
-
  $(".f-larger").click(function(){
+
     var obj = document.getElementById("illus");
-
     $("p").css("font-size","14pt");
+
    obj.innerHTML = '<h2 style="color:white" >' + name + '</h2>';
-
  });
+
    var coords = object.coords;
-
  $(".f-smaller").click(function(){
+
    var left = coords.substring(0,coords.indexOf(','));
-
     $("p").css("font-size","12pt");
+
     coords = coords.substring(coords.indexOf(',')+1);
-
  });
+
    var top = coords.substring(0,coords.indexOf(','));
-
  $(".f-medium").click(function(){
+
    coords = coords.substring(coords.indexOf(',')+1);
-
     $("p").css("font-size","13pt");
+
    var width = coords.substring(0,coords.indexOf(',')) - left;
-
  });
+
     coords = coords.substring(coords.indexOf(',')+1);
-
     ob1 = document.getElementById('col-left');
+
    obj.style.left = left + 'px';
-
     // rTop = 307;
+
    obj.style.marginTop = coords - 40  + 'px';
-
    //window.setInterval('fixedpo()',20);
+
    obj.style.width = width -20 + 'px';
-
})
+
    obj.onmouseout = function(){obj.style.display = 'none'}
 +
    obj.onmouseover = function(){obj.style.display = 'block';}
 +
     obj.onmousedown = function(){window.location.assign(object.href);}
 +
     obj.style.height = 40 + 'px';
 +
     obj.style.display = 'block';
 +
  //alert();
 +
}
 +
 
 +
 
 +
 
 +
 
 +
function hideillus(){
 +
    var obj = document.getElementById("illus");
 +
    obj.style.display = "none";
 +
}
 +
 
 +
 
 +
 
 +
 
</script>
</script>
 +
</html>

Latest revision as of 11:56, 2 October 2013