Difference between revisions of "Template:Team:Bielefeld-CeBiTec/JS"

(added code to zoom into figures)
 
(21 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<html>
 
<html>
 
<script>
 
<script>
 
 
  
 
$(document).ready(function() {
 
$(document).ready(function() {
Line 69: Line 67:
 
$(".sub-navbar").attr("style", "top: " + ($logoHeight + 16) + "px;");
 
$(".sub-navbar").attr("style", "top: " + ($logoHeight + 16) + "px;");
 
if ($imgSrc == "https://static.igem.org/mediawiki/2017/4/4a/T--Bielefeld-CeBiTec--expand_monochrome_white_2.svg") {
 
if ($imgSrc == "https://static.igem.org/mediawiki/2017/4/4a/T--Bielefeld-CeBiTec--expand_monochrome_white_2.svg") {
$(".container").attr("style", "margin-top: " + ($logoHeight + 40) + "px;");
+
//$(".container.start-page").attr("style", "padding-top: " + ($logoHeight + 10) + "px;");
 
}
 
}
 
if ($scrollHeight >= 80) {
 
if ($scrollHeight >= 80) {
Line 98: Line 96:
 
$(window).on('resize', function(){
 
$(window).on('resize', function(){
 
       resizeNavbar();
 
       resizeNavbar();
});
 
 
$(window).on('load', function() {
 
hideNavbars();
 
if ($(document).scrollTop() == 0) {
 
$("#logo-img").attr("src", "https://static.igem.org/mediawiki/2017/4/4a/T--Bielefeld-CeBiTec--expand_monochrome_white_2.svg");
 
} else {
 
$("#logo-img").attr("src", "https://static.igem.org/mediawiki/2017/6/6e/T--Bielefeld-CeBiTec--expand_monochrome_white_2_collapse.svg");
 
}
 
resizeNavbar();
 
$(".cover").hide();
 
$("#cover-set").hide();
 
$("#cover").css({"background":"rgba(0, 0, 0, 0.5)"});
 
$("#cover-box").css({"background":"rgba(255, 255, 255, 1)"});
 
 
});
 
});
  
 
$(window).on('load', function() {
 
$(window).on('load', function() {
 
$story = ["https://2017.igem.org/Team:Bielefeld-CeBiTec",
 
$story = ["https://2017.igem.org/Team:Bielefeld-CeBiTec",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Project/Overview",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Project/unnatural_base_pair",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Project/unnatural_base_pair",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Project/unnatural_base_pair/unnatural_base_pairs",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Project/unnatural_base_pair/unnatural_base_pairs",
Line 130: Line 115:
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Project/toolbox/photolysis",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Project/toolbox/photolysis",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Project/toolbox/fusing",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Project/toolbox/fusing",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Demonstrate",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Results/unnatural_base_pair",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Results/unnatural_base_pair",
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Results/unnatural_base_pair/uptake_and_biosynthesis",
+
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Results/unnatural_base_pair/uptake",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Results/unnatural_base_pair/biosynthesis",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Results/unnatural_base_pair/preservation_system",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Results/unnatural_base_pair/preservation_system",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Results/unnatural_base_pair/development_of_new_methods",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Results/unnatural_base_pair/development_of_new_methods",
Line 143: Line 130:
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Results/toolbox/photolysis",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Results/toolbox/photolysis",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Results/toolbox/fusing",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Results/toolbox/fusing",
"https://2017.igem.org/Team:Bielefeld-CeBiTec/InterLab",
 
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Parts",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Parts",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Basic_Part",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Basic_Part",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Composite_Part",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Composite_Part",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Part_Collection",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Part_Collection",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Improve",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Achievements",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Achievements",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Hardware",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Hardware",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Software",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Software",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Model",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Model",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Measurement",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Applied_Design",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/InterLab",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/HP",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/HP",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/HP/Silver",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/HP/Silver",
Line 167: Line 157:
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Notebook/Oligonucleotides",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Notebook/Oligonucleotides",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Notebook/Labjournal",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Notebook/Labjournal",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Notebook/LabnotesGenerator",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Safety"];
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Safety"];
 
 
 
$url = window.location.href;
 
$url = window.location.href;
 +
if ($url.indexOf("#") > -1) {
 +
$url = $url.substring(0, $url.indexOf("#"));
 +
}
 
$index = 0;
 
$index = 0;
 
for (i = 0; i < $story.length; i++) {
 
for (i = 0; i < $story.length; i++) {
Line 179: Line 173:
 
if ($index == 0) {
 
if ($index == 0) {
 
$("#page-switch-prev-li").hide();
 
$("#page-switch-prev-li").hide();
 +
$("#footer-left").html("<p></p>");
 
} else {
 
} else {
 
$("#page-switch-prev").attr("href", $story[$index - 1]);
 
$("#page-switch-prev").attr("href", $story[$index - 1]);
Line 188: Line 183:
 
}
 
}
 
 
 +
hideNavbars();
 +
if ($(document).scrollTop() == 0) {
 +
$("#logo-img").attr("src", "https://static.igem.org/mediawiki/2017/4/4a/T--Bielefeld-CeBiTec--expand_monochrome_white_2.svg");
 +
} else {
 +
$("#logo-img").attr("src", "https://static.igem.org/mediawiki/2017/6/6e/T--Bielefeld-CeBiTec--expand_monochrome_white_2_collapse.svg");
 +
}
 +
resizeNavbar();
 +
$(".cover").hide();
 +
$("#cover-set").hide();
 +
$("#cover").css({"background":"rgba(0, 0, 0, 0.5)"});
 +
$("#cover-box").css({"background":"rgba(255, 255, 255, 1)"});
 +
$("#cover-box-img").css({"background":"rgba(255, 255, 255, 1)"});
 +
$("#cover-box-text").css({"background":"rgba(255, 255, 255, 1)"});
 +
 +
if ($(window).scrollTop() == 0) {
 +
$("#page-arrow-top").css("display", "none");
 +
} else {
 +
$("#page-arrow-top").css("display", "block");
 +
}
 +
 +
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i.test(navigator.userAgent)) {
 +
$(".test").html("mobile");
 +
} else {
 +
$(".test").html("not mobile");
 +
}
 
});
 
});
  
Line 468: Line 488:
  
  
$(document).ready(function() {
+
/*$(document).ready(function() {
 
     $(".figure").mousedown(function() {
 
     $(".figure").mousedown(function() {
 
$clickItem = $(this);
 
$clickItem = $(this);
Line 480: Line 500:
 
$("#cover-img").height($newSize + "px");
 
$("#cover-img").height($newSize + "px");
 
}
 
}
$("#cover-p").html($p.html());
+
$size = $("#cover-set").width();
 +
/*if ($size > $("#cover-box").width()) {
 +
$newSize = ($("#cover-box").width());
 +
$("#cover-img").width($newSize + "px");
 +
}*/
 +
/*$("#cover-p").html($p.html());
 
$(".cover").fadeIn(200);
 
$(".cover").fadeIn(200);
$(".test").html($size);
+
 +
 +
$topPos = $("#cover-box").position().top;
 +
$(".test").html($("#cover-box").height());
 +
$topPos = $("#cover-box").height() * 0.5 + 30 + "px";
 +
$("#cover-box").css("top", $topPos);
 
     });
 
     });
});
+
});*/
  
 
$(document).ready(function() {
 
$(document).ready(function() {
Line 492: Line 522:
 
});
 
});
  
 +
$(document).ready(function() {
 +
    $(".page-switch.prev").mouseover(function() {
 +
$hoverItem = $(this);
 +
$hoverItem.attr("src", "https://static.igem.org/mediawiki/2017/c/cd/T--Bielefeld-CeBiTec--page-arrow-previous-white.svg");
 +
    });
 +
$(".page-switch.next").mouseover(function() {
 +
$hoverItem = $(this);
 +
$hoverItem.attr("src", "https://static.igem.org/mediawiki/2017/4/45/T--Bielefeld-CeBiTec--page-arrow-next-white.svg");
 +
    });
 +
$("#page-arrow-top").mouseover(function() {
 +
$hoverItem = $(this);
 +
$hoverItem.attr("src", "https://static.igem.org/mediawiki/2017/d/dc/T--Bielefeld-CeBiTec--page-arrow-top-white.svg");
 +
    });
 +
});
  
 +
$(document).ready(function() {
 +
    $(".page-switch.prev").mouseout(function() {
 +
$hoverItem = $(this);
 +
$hoverItem.attr("src", "https://static.igem.org/mediawiki/2017/4/44/T--Bielefeld-CeBiTec--page-arrow-previous.svg");
 +
    });
 +
$(".page-switch.next").mouseout(function() {
 +
$hoverItem = $(this);
 +
$hoverItem.attr("src", "https://static.igem.org/mediawiki/2017/c/c8/T--Bielefeld-CeBiTec--page-arrow-next.svg");
 +
    });
 +
$("#page-arrow-top").mouseout(function() {
 +
$hoverItem = $(this);
 +
$hoverItem.attr("src", "https://static.igem.org/mediawiki/2017/b/b2/T--Bielefeld-CeBiTec--page-arrow-top.svg");
 +
    });
 +
});
 +
 +
function topFunction() {
 +
    document.body.scrollTop = 0; // For Chrome, Safari and Opera
 +
    document.documentElement.scrollTop = 0; // For IE and Firefox
 +
}
 +
 +
$(window).scroll(function(){
 +
if ($(window).scrollTop() == 0) {
 +
$("#page-arrow-top").css("display", "none");
 +
} else {
 +
$("#page-arrow-top").css("display", "block");
 +
}
 +
if ($(window).scrollTop() > 50) {
 +
$("#page-arrow-top").css("opacity", 1);
 +
} else {
 +
$("#page-arrow-top").css("opacity", ($(window).scrollTop() / 50));
 +
}
 +
    if ($(window).scrollTop() > $(document).height() - $(window).height() - 80) {
 +
$newPos = 20 + ($(window).scrollTop() - ($(document).height() - $(window).height() - 80));
 +
$("#page-arrow-top").css("bottom", $newPos + "px");
 +
    } else {
 +
$("#page-arrow-top").css("bottom", "20px");
 +
}
 +
});
 +
 +
$(document).ready(function() {
 +
    $(".hidden-expand").mousedown(function() {
 +
$clickItem = $(this);
 +
$clickItem.parent().next(".hidden-block").slideToggle(500, function() {});
 +
    });
 +
});
  
  
 
</script>
 
</script>
 
</html>
 
</html>

Latest revision as of 03:57, 2 November 2017