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

m
 
(74 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<html>
 
<html>
 
<script>
 
<script>
 
 
 
function toggleContent() {
 
//textVar = "title_" + id
 
$title = $(".labnote-title");
 
$title.hide();
 
//$title.hide();
 
//$content = $title.next();
 
//$content.slideToggle(500);
 
}
 
  
 
$(document).ready(function() {
 
$(document).ready(function() {
Line 30: Line 19:
 
});
 
});
  
$(window).on('load', function() {
+
function resizeNavbar() {
hideNavbars();
+
 +
$imgSrc = $("#logo-img").attr("src");
 +
if ($("#logo-img").attr("class") == "navbar center shrink") {
 +
if ($imgSrc == "https://static.igem.org/mediawiki/2017/4/4a/T--Bielefeld-CeBiTec--expand_monochrome_white_2.svg") {
 +
$("#logo-img").attr("src", "https://static.igem.org/mediawiki/2017/a/ad/T--Bielefeld-CeBiTec--expand_monochrome_white_2_trans1.svg");
 +
} else if ($imgSrc == "https://static.igem.org/mediawiki/2017/a/ad/T--Bielefeld-CeBiTec--expand_monochrome_white_2_trans1.svg") {
 +
$("#logo-img").attr("src", "https://static.igem.org/mediawiki/2017/1/16/T--Bielefeld-CeBiTec--expand_monochrome_white_2_trans2.svg");
 +
} else if ($imgSrc == "https://static.igem.org/mediawiki/2017/1/16/T--Bielefeld-CeBiTec--expand_monochrome_white_2_trans2.svg") {
 +
$("#logo-img").attr("src", "https://static.igem.org/mediawiki/2017/0/0c/T--Bielefeld-CeBiTec--expand_monochrome_white_2_trans3.svg");
 +
} else if ($imgSrc == "https://static.igem.org/mediawiki/2017/0/0c/T--Bielefeld-CeBiTec--expand_monochrome_white_2_trans3.svg") {
 +
$("#logo-img").attr("src", "https://static.igem.org/mediawiki/2017/6/6e/T--Bielefeld-CeBiTec--expand_monochrome_white_2_collapse.svg");
 +
}
 +
} else if ($("#logo-img").attr("class") == "navbar center grow") {
 +
if ($imgSrc == "https://static.igem.org/mediawiki/2017/6/6e/T--Bielefeld-CeBiTec--expand_monochrome_white_2_collapse.svg") {
 +
$("#logo-img").attr("src", "https://static.igem.org/mediawiki/2017/0/0c/T--Bielefeld-CeBiTec--expand_monochrome_white_2_trans3.svg");
 +
} else if ($imgSrc == "https://static.igem.org/mediawiki/2017/0/0c/T--Bielefeld-CeBiTec--expand_monochrome_white_2_trans3.svg") {
 +
$("#logo-img").attr("src", "https://static.igem.org/mediawiki/2017/1/16/T--Bielefeld-CeBiTec--expand_monochrome_white_2_trans2.svg");
 +
} else if ($imgSrc == "https://static.igem.org/mediawiki/2017/1/16/T--Bielefeld-CeBiTec--expand_monochrome_white_2_trans2.svg") {
 +
$("#logo-img").attr("src", "https://static.igem.org/mediawiki/2017/a/ad/T--Bielefeld-CeBiTec--expand_monochrome_white_2_trans1.svg");
 +
} else if ($imgSrc == "https://static.igem.org/mediawiki/2017/a/ad/T--Bielefeld-CeBiTec--expand_monochrome_white_2_trans1.svg") {
 +
$("#logo-img").attr("src", "https://static.igem.org/mediawiki/2017/4/4a/T--Bielefeld-CeBiTec--expand_monochrome_white_2.svg");
 +
}
 +
}
 +
$imgSrc = $("#logo-img").attr("src");
 +
 +
$logoHeight = $("#logo").innerHeight();
 +
$newHeight = $logoHeight * 0.5;
 +
$("header").attr("style", "height: " + $logoHeight + "px;");
 +
$scrollHeight = 50;
 +
if ($imgSrc == "https://static.igem.org/mediawiki/2017/4/4a/T--Bielefeld-CeBiTec--expand_monochrome_white_2.svg") {
 +
$scrollHeight = 50;
 +
} else if ($imgSrc == "https://static.igem.org/mediawiki/2017/a/ad/T--Bielefeld-CeBiTec--expand_monochrome_white_2_trans1.svg") {
 +
$scrollHeight = 62.5;
 +
} else if ($imgSrc == "https://static.igem.org/mediawiki/2017/1/16/T--Bielefeld-CeBiTec--expand_monochrome_white_2_trans2.svg") {
 +
$scrollHeight = 75;
 +
} else if ($imgSrc == "https://static.igem.org/mediawiki/2017/0/0c/T--Bielefeld-CeBiTec--expand_monochrome_white_2_trans3.svg") {
 +
$scrollHeight = 87.5;
 +
} else if ($imgSrc == "https://static.igem.org/mediawiki/2017/6/6e/T--Bielefeld-CeBiTec--expand_monochrome_white_2_collapse.svg") {
 +
$scrollHeight = 100;
 +
}
 +
 +
$("#navbar-left, #navbar-right").attr("style", "height: " + $scrollHeight + "%;");
 +
$("li.navbar").attr("style", "height: 100%; line-height: " + ($logoHeight * ($scrollHeight/100)) + "px;");
 +
$(".navbar-paragraph").attr("style", "height: " + (100 - $scrollHeight) + "%;");
 +
$("li.navbar-paragraph").attr("style", "line-height: " + ($logoHeight * ((100 - $scrollHeight)/100)) + "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") {
 +
//$(".container.start-page").attr("style", "padding-top: " + ($logoHeight + 10) + "px;");
 +
}
 +
if ($scrollHeight >= 80) {
 +
$("li.navbar-paragraph").hide();
 +
} else {
 +
$("li.navbar-paragraph").show();
 +
}
 +
 +
 +
$widthItemsLeft = $("#project").width();
 +
$widthItemsLeft = $widthItemsLeft + $("#results").width();
 +
$widthItemsLeft = $widthItemsLeft + $("#specials").width();
 +
$widthItemsLeft = $widthItemsLeft + $("#hp").width();
 +
 +
$widthItemsRight = $("#collaborations").width();
 +
$widthItemsRight = $widthItemsRight + $("#team").width();
 +
$widthItemsRight = $widthItemsRight + $("#partners").width();
 +
$widthItemsRight = $widthItemsRight + $("#notebook").width();
 +
 +
$widthDiff = ($widthItemsLeft - $widthItemsRight);
 +
$addUp = ($widthDiff / 4);
 +
$("#collaborations").width($("#collaborations").width() + $addUp);
 +
$("#team").width($("#team").width() + $addUp);
 +
$("#partners").width($("#partners").width() + $addUp);
 +
$("#notebook").width($("#notebook").width() + $addUp);
 +
}
 +
 
 +
$(window).on('resize', function(){
 +
      resizeNavbar();
 
});
 
});
  
 
$(window).on('load', function() {
 
$(window).on('load', function() {
$url = window.location.href.split("/");
+
$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/unnatural_base_pairs",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Project/unnatural_base_pair/uptake_and_biosynthesis",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Project/unnatural_base_pair/preservation_system",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Project/unnatural_base_pair/challenges",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Project/translational_system",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Project/translational_system/translation_mechanism",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Project/translational_system/library_and_selection",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Project/toolbox",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Project/toolbox/analysing",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Project/toolbox/photoswitching",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Project/toolbox/labeling",
 +
"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/Demonstrate",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Results/unnatural_base_pair",
 +
"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/development_of_new_methods",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Results/translational_system",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Results/translational_system/translation_mechanism",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Results/translational_system/library_and_selection",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Results/toolbox",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Results/toolbox/analysing",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Results/toolbox/photoswitching",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Results/toolbox/labeling",
 +
"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/Parts",
 +
"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/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/Hardware",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Software",
 +
"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/Silver",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/HP/Gold_Integrated",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Engagement",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Collaborations",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Team",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Team/Advisors",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Team/Bielefeld",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Team/CeBiTec",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Team/Bielefeld_University",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Attributions",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Partners",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Notebook/Methods",
 +
"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/LabnotesGenerator",
 +
"https://2017.igem.org/Team:Bielefeld-CeBiTec/Safety"];
 
 
var dict = {
+
$url = window.location.href;
"project" : "project",
+
if ($url.indexOf("#") > -1) {
"description" : "project"
+
$url = $url.substring(0, $url.indexOf("#"));
 
}
 
}
+
$index = 0;
var i;
+
for (i = 0; i < $story.length; i++) {
for (i = 2; i < $url.length; ++i) {
+
if ($story[i] == $url) {
$str = $url[i].toLowerCase();
+
$index = i;
$str = dict[$str];
+
i = $story.length;
$("#" + $str).addClass("navbar active");
+
}
 +
}
 +
if ($index == 0) {
 +
$("#page-switch-prev-li").hide();
 +
$("#footer-left").html("<p></p>");
 +
} else {
 +
$("#page-switch-prev").attr("href", $story[$index - 1]);
 +
}
 +
if ($index == $story.length - 1) {
 +
$("#page-switch-next-li").hide();
 +
} else {
 +
$("#page-switch-next").attr("href", $story[$index + 1]);
 +
}
 +
 +
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 54: Line 214:
 
$("#navbar-project").hide();
 
$("#navbar-project").hide();
 
$("#navbar-results").hide();
 
$("#navbar-results").hide();
 +
$("#navbar-specials").hide();
 
$("#navbar-hp").hide();
 
$("#navbar-hp").hide();
 
$("#navbar-team").hide();
 
$("#navbar-team").hide();
Line 69: Line 230:
 
}
 
}
  
 +
/* Remove the highlighted style from all navbar buttons */
 +
function unhighlightTabs($x) {
 +
if ($x == true) {
 +
$objects = [$("#project-ubp"), $("#project-translation"), $("#project-toolbox"), $("#results-ubp"),
 +
$("#results-translation"), $("#results-toolbox"), $("#results-parts")];
 +
} else {
 +
$objects = [$("#project"), $("#results"), $("#specials"), $("#hp"), $("#team"), $("#notebook"), $("#project-ubp"),
 +
$("#project-translation"), $("#project-toolbox"), $("#results-ubp"), $("#results-translation"),
 +
$("#results-toolbox"), $("#results-parts")];
 +
}
 +
for (i = 0; i < $objects.length; i++) {
 +
$object = $objects[i];
 +
if ($object.attr("class") == "navbar active highlighted") {
 +
$object.attr("class", "navbar active");
 +
} else if ($object.attr("class") == "navbar item-left active highlighted") {
 +
$object.attr("class", "navbar item-left active");
 +
} else if ($object.attr("class") == "navbar item-right active highlighted") {
 +
$object.attr("class", "navbar item-right active");
 +
} else if ($object.attr("class") == "navbar highlighted") {
 +
$object.attr("class", "navbar");
 +
} else if ($object.attr("class") == "navbar item-left highlighted") {
 +
$object.attr("class", "navbar item-left");
 +
} else if ($object.attr("class") == "navbar item-right highlighted") {
 +
$object.attr("class", "navbar item-right");
 +
} else if ($object.attr("class") == "sub-navbar-item active highlighted"  || $object.attr("class") == "sub-navbar-item navbar active highlighted") {
 +
$object.attr("class", "sub-navbar-item active");
 +
} else if ($object.attr("class") == "sub-navbar-item highlighted") {
 +
$object.attr("class", "sub-navbar-item");
 +
}
 +
 +
if ($object.attr("class") == "sub-navbar-item navbar active") {
 +
$object.attr("class", "sub-navbar-item active");
 +
}
 +
if ($object.attr("class") == "sub-navbar-item small navbar active") {
 +
$object.attr("class", "sub-navbar-item small active");
 +
}
 +
}
 +
}
 +
 +
/* Handle clicks on the navbar items */
 
$(document).ready(function() {
 
$(document).ready(function() {
     $("li.navbar, li.sub-navbar-item").mouseover(function() {
+
     $("li.navbar, li.sub-navbar-item").mousedown(function() {
 +
$clickItem = this;
 
$name = this.id;
 
$name = this.id;
 +
$class = $(this).attr("class");
 
 
 +
$(".sub-navbar").show();
 
if ($name == "project") {
 
if ($name == "project") {
$(".sub-navbar").show();
+
if ($class == "navbar item-left" || $class == "navbar item-left active") {
hideNavbars();
+
unhighlightTabs(false);
$("#navbar-project").show();
+
$(".sub-navbar").show();
 +
hideNavbars();
 +
$("#navbar-project").show();
 +
$(this).attr("class", $class + " highlighted");
 +
} else {
 +
$(".sub-navbar").hide();
 +
hideNavbars();
 +
unhighlightTabs(false);
 +
}
 
} else if ($name == "results") {
 
} else if ($name == "results") {
$(".sub-navbar").show();
+
if ($class == "navbar item-left" || $class == "navbar item-left active") {
hideNavbars();
+
unhighlightTabs(false);
$("#navbar-results").show();
+
$(".sub-navbar").show();
} else if ($name == "human practice") {
+
hideNavbars();
$(".sub-navbar").show();
+
$("#navbar-results").show();
hideNavbars();
+
$(this).attr("class", $class + " highlighted");
$("#navbar-hp").show();
+
} else {
 +
$(".sub-navbar").hide();
 +
hideNavbars();
 +
unhighlightTabs(false);
 +
}
 +
} else if ($name == "specials") {
 +
if ($class == "navbar item-left" || $class == "navbar item-left active") {
 +
unhighlightTabs(false);
 +
$(".sub-navbar").show();
 +
hideNavbars();
 +
$("#navbar-specials").show();
 +
$(this).attr("class", $class + " highlighted");
 +
} else {
 +
$(".sub-navbar").hide();
 +
hideNavbars();
 +
unhighlightTabs(false);
 +
}
 +
} else if ($name == "hp") {
 +
if ($class == "navbar item-left" || $class == "navbar item-left active") {
 +
unhighlightTabs(false);
 +
$(".sub-navbar").show();
 +
hideNavbars();
 +
$("#navbar-hp").show();
 +
$(this).attr("class", $class + " highlighted");
 +
} else {
 +
$(".sub-navbar").hide();
 +
hideNavbars();
 +
unhighlightTabs(false);
 +
}
 
} else if ($name == "team") {
 
} else if ($name == "team") {
$(".sub-navbar").show();
+
if ($class == "navbar item-right" || $class == "navbar item-right active") {
hideNavbars();
+
unhighlightTabs(false);
$("#navbar-team").show();
+
$(".sub-navbar").show();
 +
hideNavbars();
 +
$("#navbar-team").show();
 +
$(this).attr("class", $class + " highlighted");
 +
} else {
 +
$(".sub-navbar").hide();
 +
hideNavbars();
 +
unhighlightTabs(false);
 +
}
 
} else if ($name == "notebook") {
 
} else if ($name == "notebook") {
$(".sub-navbar").show();
+
if ($class == "navbar item-right" || $class == "navbar item-right active") {
hideNavbars();
+
unhighlightTabs(false);
$("#navbar-notebook").show();
+
$(".sub-navbar").show();
 +
hideNavbars();
 +
$("#navbar-notebook").show();
 +
$(this).attr("class", $class + " highlighted");
 +
} else {
 +
$(".sub-navbar").hide();
 +
hideNavbars();
 +
unhighlightTabs(false);
 +
}
 
} else if ($name == "project-ubp") {
 
} else if ($name == "project-ubp") {
$(".sub-navbar").show();
+
if ($class == "sub-navbar-item" || $class == "sub-navbar-item active" || $class == "sub-navbar-item navbar active") {
hideNavbarsSub();
+
unhighlightTabs(true);
$("#navbar-project-ubp").show();
+
$(".sub-navbar").show();
 +
hideNavbarsSub();
 +
$("#navbar-project-ubp").show();
 +
$(this).attr("class", $class + " highlighted");
 +
} else {
 +
hideNavbarsSub();
 +
unhighlightTabs(true);
 +
}
 
} else if ($name == "project-translation") {
 
} else if ($name == "project-translation") {
$(".sub-navbar").show();
+
if ($class == "sub-navbar-item" || $class == "sub-navbar-item active" || $class == "sub-navbar-item navbar active") {
hideNavbarsSub();
+
unhighlightTabs(true);
$("#navbar-project-translation").show();
+
$(".sub-navbar").show();
 +
hideNavbarsSub();
 +
$("#navbar-project-translation").show();
 +
$(this).attr("class", $class + " highlighted");
 +
} else {
 +
hideNavbarsSub();
 +
unhighlightTabs(true);
 +
}
 
} else if ($name == "project-toolbox") {
 
} else if ($name == "project-toolbox") {
$(".sub-navbar").show();
+
if ($class == "sub-navbar-item" || $class == "sub-navbar-item active" || $class == "sub-navbar-item navbar active") {
hideNavbarsSub();
+
unhighlightTabs(true);
$("#navbar-project-toolbox").show();
+
$(".sub-navbar").show();
 +
hideNavbarsSub();
 +
$("#navbar-project-toolbox").show();
 +
$(this).attr("class", $class + " highlighted");
 +
} else {
 +
hideNavbarsSub();
 +
unhighlightTabs(true);
 +
}
 
} else if ($name == "results-ubp") {
 
} else if ($name == "results-ubp") {
$(".sub-navbar").show();
+
if ($class == "sub-navbar-item" || $class == "sub-navbar-item active" || $class == "sub-navbar-item navbar active") {
hideNavbarsSub();
+
unhighlightTabs(true);
$("#navbar-results-ubp").show();
+
$(".sub-navbar").show();
 +
hideNavbarsSub();
 +
$("#navbar-results-ubp").show();
 +
$(this).attr("class", $class + " highlighted");
 +
} else {
 +
hideNavbarsSub();
 +
unhighlightTabs(true);
 +
}
 
} else if ($name == "results-translation") {
 
} else if ($name == "results-translation") {
$(".sub-navbar").show();
+
if ($class == "sub-navbar-item" || $class == "sub-navbar-item active" || $class == "sub-navbar-item navbar active") {
hideNavbarsSub();
+
unhighlightTabs(true);
$("#navbar-results-translation").show();
+
$(".sub-navbar").show();
 +
hideNavbarsSub();
 +
$("#navbar-results-translation").show();
 +
$(this).attr("class", $class + " highlighted");
 +
} else {
 +
hideNavbarsSub();
 +
unhighlightTabs(true);
 +
}
 
} else if ($name == "results-toolbox") {
 
} else if ($name == "results-toolbox") {
$(".sub-navbar").show();
+
if ($class == "sub-navbar-item" || $class == "sub-navbar-item active" || $class == "sub-navbar-item navbar active") {
hideNavbarsSub();
+
unhighlightTabs(true);
$("#navbar-results-toolbox").show();
+
$(".sub-navbar").show();
 +
hideNavbarsSub();
 +
$("#navbar-results-toolbox").show();
 +
$(this).attr("class", $class + " highlighted");
 +
} else {
 +
hideNavbarsSub();
 +
unhighlightTabs(true);
 +
}
 
} else if ($name == "results-parts") {
 
} else if ($name == "results-parts") {
$(".sub-navbar").show();
+
if ($class == "sub-navbar-item" || $class == "sub-navbar-item active" || $class == "sub-navbar-item navbar active") {
 +
unhighlightTabs(true);
 +
$(".sub-navbar").show();
 +
hideNavbarsSub();
 +
$("#navbar-results-parts").show();
 +
$(this).attr("class", $class + " highlighted");
 +
} else {
 +
hideNavbarsSub();
 +
unhighlightTabs(true);
 +
}
 +
} else if ($name == "home" || $name == "partners" || $name == "collaborations" || $name == "modelling" || $name == "hardware") {
 
hideNavbarsSub();
 
hideNavbarsSub();
$("#navbar-results-parts").show();
+
$(".sub-navbar").hide();
 
}
 
}
 
 
 +
//get center x position of item and place subitems centered to this
 +
if ($(this).html().indexOf("▼") > -1) {
 +
$middle = $(this).position().left + ($(this).width() * 0.5);
 +
$totalWidth = 0;
 +
 +
$('.sub-navbar-item').each(function(i, obj) {
 +
if ($(obj).is(":visible")) {
 +
if ($($clickItem).hasClass("sub-navbar-item")) {
 +
if ($(obj).hasClass("small")) {
 +
if ($totalWidth == 0) {
 +
$leftItem = obj;
 +
}
 +
$totalWidth = $totalWidth + $(obj).width();
 +
}
 +
} else {
 +
if ($totalWidth == 0) {
 +
$leftItem = obj;
 +
}
 +
$totalWidth = $totalWidth + $(obj).width();
 +
}
 +
}
 +
});
 +
$newPos = ($middle - ($totalWidth * 0.5));
 +
if ($newPos < 0) {
 +
$newPos = 0;
 +
}
 +
if ($newPos + $totalWidth > $("body").width()) {
 +
$newPos = $("body").width() - $totalWidth;
 +
}
 +
$newPos = $newPos + "px";
 +
 +
$($leftItem).css({'margin-left':$newPos});
 +
}
 
     });
 
     });
 
});
 
});
  
 
$(document).ready(function() {
 
$(document).ready(function() {
     $(".contentbox").mouseover(function() {
+
     $("body").mousedown(function( event ) {
$(".sub-navbar").hide();
+
//$(".test").html($("#project").attr("class"));
hideNavbars();
+
if (event.pageY - $(document).scrollTop() > 16 + $("#logo").outerHeight() + $(".sub-navbar").outerHeight()) {
 +
$(".sub-navbar").hide();
 +
hideNavbars();
 +
unhighlightTabs();
 +
}
 +
    });
 +
});
 +
 
 +
window.setInterval(function(){
 +
if ($(document).scrollTop() <= 5) {
 +
$("#logo-img").attr("class", "navbar center grow");
 +
} else {
 +
$("#logo-img").attr("class", "navbar center shrink");
 +
}
 +
resizeNavbar();
 +
}, 10);
 +
 
 +
 
 +
/*$(document).ready(function() {
 +
    $(".figure").mousedown(function() {
 +
$clickItem = $(this);
 +
$img = $clickItem.children("img");
 +
$p = $clickItem.children("p");
 +
$("#cover-img").attr("src", $img.attr("src"));
 +
$("#cover-set").attr("src", $img.attr("src"));
 +
$size = $("#cover-set").height();
 +
if ($size > $("#cover-box").height() * 0.85) {
 +
$newSize = ($("#cover-box").height() * 0.85);
 +
$("#cover-img").height($newSize + "px");
 +
}
 +
$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);
 
 
 +
 +
$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() {
 +
    $(".cover").mousedown(function() {
 +
$(".cover").fadeOut(200);
 
     });
 
     });
 
});
 
});
  
 +
$(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