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

(added script for scroll top button)
 
(12 intermediate revisions by the same user not shown)
Line 66: Line 66:
 
$("li.navbar-paragraph").attr("style", "line-height: " + ($logoHeight * ((100 - $scrollHeight)/100)) + "px;");
 
$("li.navbar-paragraph").attr("style", "line-height: " + ($logoHeight * ((100 - $scrollHeight)/100)) + "px;");
 
$(".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 + 10) + "px;");
+
//$(".container.start-page").attr("style", "padding-top: " + ($logoHeight + 10) + "px;");
}*/
+
}
 
if ($scrollHeight >= 80) {
 
if ($scrollHeight >= 80) {
 
$("li.navbar-paragraph").hide();
 
$("li.navbar-paragraph").hide();
Line 100: Line 100:
 
$(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 114: 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 127: 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/Demonstrate",
 
 
"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",
Line 137: Line 139:
 
"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/InterLab",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/HP",
 
"https://2017.igem.org/Team:Bielefeld-CeBiTec/HP",
Line 153: 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"];
 
 
Line 177: Line 182:
 
$("#page-switch-next").attr("href", $story[$index + 1]);
 
$("#page-switch-next").attr("href", $story[$index + 1]);
 
}
 
}
 
//recolor contentboxes
 
$('.contentbox').each(function(i, obj) {
 
if ((i % 2) == 1) {
 
$(obj).css("background", "#f0f0f0");
 
} else if ((i % 2) == 0) {
 
$(obj).css("background", "#ffffff");
 
}
 
$content = $(obj).children(".content");
 
});
 
//recolor labnote contentboxes
 
/*$('.labnotebox').each(function(i, obj) {
 
if ((i % 2) == 1) {
 
$(obj).css("background", "#f0f0f0");
 
} else if ((i % 2) == 0) {
 
$(obj).css("background", "#ffffff");
 
}
 
$content = $(obj).children(".labnote-content");
 
});*/
 
 
 
 
hideNavbars();
 
hideNavbars();
Line 211: Line 197:
 
$("#cover-box-text").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 491: Line 488:
  
  
$(document).ready(function() {
+
/*$(document).ready(function() {
 
     $(".figure").mousedown(function() {
 
     $(".figure").mousedown(function() {
 
$clickItem = $(this);
 
$clickItem = $(this);
Line 508: Line 505:
 
$("#cover-img").width($newSize + "px");
 
$("#cover-img").width($newSize + "px");
 
}*/
 
}*/
$("#cover-p").html($p.html());
+
/*$("#cover-p").html($p.html());
 
$(".cover").fadeIn(200);
 
$(".cover").fadeIn(200);
 
 
Line 517: Line 514:
 
$("#cover-box").css("top", $topPos);
 
$("#cover-box").css("top", $topPos);
 
     });
 
     });
});
+
});*/
  
 
$(document).ready(function() {
 
$(document).ready(function() {
Line 536: Line 533:
 
$("#page-arrow-top").mouseover(function() {
 
$("#page-arrow-top").mouseover(function() {
 
$hoverItem = $(this);
 
$hoverItem = $(this);
$hoverItem.attr("src", "page_arrow_top_white.svg");
+
$hoverItem.attr("src", "https://static.igem.org/mediawiki/2017/d/dc/T--Bielefeld-CeBiTec--page-arrow-top-white.svg");
 
     });
 
     });
 
});
 
});
Line 551: Line 548:
 
$("#page-arrow-top").mouseout(function() {
 
$("#page-arrow-top").mouseout(function() {
 
$hoverItem = $(this);
 
$hoverItem = $(this);
$hoverItem.attr("src", "page_arrow_top.svg");
+
$hoverItem.attr("src", "https://static.igem.org/mediawiki/2017/b/b2/T--Bielefeld-CeBiTec--page-arrow-top.svg");
 
     });
 
     });
 
});
 
});
Line 577: Line 574:
 
$("#page-arrow-top").css("bottom", "20px");
 
$("#page-arrow-top").css("bottom", "20px");
 
}
 
}
 +
});
 +
 +
$(document).ready(function() {
 +
    $(".hidden-expand").mousedown(function() {
 +
$clickItem = $(this);
 +
$clickItem.parent().next(".hidden-block").slideToggle(500, function() {});
 +
    });
 
});
 
});
  

Latest revision as of 03:57, 2 November 2017