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

(Replaced content with "<html> <script> else if ($name == "home") { $(".sub-navbar").hide(); } </script> </html>")
(Undo revision 100276 by Medich (talk))
Line 4: Line 4:
  
  
else if ($name == "home") {
+
function toggleContent() {
$(".sub-navbar").hide();
+
//textVar = "title_" + id
 +
$title = $(".labnote-title");
 +
$title.hide();
 +
//$title.hide();
 +
//$content = $title.next();
 +
//$content.slideToggle(500);
 +
}
 +
 
 +
$(document).ready(function() {
 +
    $(".labnote-title").click(function() {
 +
        $title = $(this);
 +
$content = $title.next();
 +
if (!$content.is(":visible")) {
 +
$title.css("border-bottom-right-radius", "0px");
 +
$title.css("border-bottom-left-radius", "0px");
 
}
 
}
 +
$content.slideToggle(500, function() {
 +
if (!$content.is(":visible")) {
 +
$title.css("border-radius", "8px");
 +
$title.css("zIndex", "0");
 +
}
 +
});
 +
    });
 +
});
 +
 +
$(window).on('load', function() {
 +
hideNavbars();
 +
});
 +
 +
$(window).on('load', function() {
 +
$url = window.location.href.split("/");
 +
 +
var dict1 = {
 +
"description" : "project",
 +
"hp" : "human practice",
 +
"model" : "modelling",
 +
"results" : "results",
 +
"collaborations" : "collaborations",
 +
"team" : "team",
 +
"partners" : "partners",
 +
"notebook" : "notebook",
 +
"silver" : "hp-silver",
 +
"gold_integrated" : "hp-gold",
 +
"unnatural_base_pair" : "project"
 +
}
 +
 +
var dict2 = {
 +
"unnatural_base_pair" : "project-ubp"
 +
}
 +
 +
var dict3 = {
 +
"unnatural_base_pair" : "project-ubp-overview",
 +
"unnatural_base_pairs" : "project-ubp-ubp",
 +
"uptake_and_biosynthesis" : "project-ubp-uptake",
 +
"preservation_system" : "project-ubp-preservation",
 +
"challenges" : "project-ubp-challenges",
 +
"translational_system" : "project-translation-overview",
 +
"translation_mechanism" : "project-translation-mechanism",
 +
"library_and_selection" : "project-translation-Library",
 +
"toolbox" : "project-toolbox-overview",
 +
"analysing" : "project-toolbox-analysing",
 +
"photoswitching" : "project-toolbox-photoswitching",
 +
"labeling" : "project-toolbox-labeling",
 +
"photolysis" : "project-toolbox-photolysis",
 +
"fusing" : "project-toolbox-fusing"
 +
}
 +
 +
var i;
 +
for (i = 2; i < $url.length; ++i) {
 +
$str = $url[i].toLowerCase();
 +
$strD = dict1[$str];
 +
$("#" + $strD).addClass("navbar active");
 +
$strD = dict2[$str];
 +
$("#" + $strD).addClass("navbar active");
 +
$strD = dict3[$str];
 +
$("#" + $strD).addClass("navbar active");
 +
}
 +
});
 +
 +
function hideNavbars() {
 +
hideNavbarsSub();
 +
$("#navbar-project").hide();
 +
$("#navbar-results").hide();
 +
$("#navbar-hp").hide();
 +
$("#navbar-team").hide();
 +
$("#navbar-notebook").hide();
 +
}
 +
 +
function hideNavbarsSub() {
 +
$("#navbar-project-ubp").hide();
 +
$("#navbar-project-translation").hide();
 +
$("#navbar-project-toolbox").hide();
 +
$("#navbar-results-ubp").hide();
 +
$("#navbar-results-translation").hide();
 +
$("#navbar-results-toolbox").hide();
 +
$("#navbar-results-parts").hide();
 +
}
 +
 +
$(document).ready(function() {
 +
    $("li.navbar, li.sub-navbar-item").mouseover(function() {
 +
$name = this.id;
 +
 +
if ($name == "project") {
 +
$(".sub-navbar").show();
 +
hideNavbars();
 +
$("#navbar-project").show();
 +
} else if ($name == "results") {
 +
$(".sub-navbar").show();
 +
hideNavbars();
 +
$("#navbar-results").show();
 +
} else if ($name == "human practice") {
 +
$(".sub-navbar").show();
 +
hideNavbars();
 +
$("#navbar-hp").show();
 +
} else if ($name == "team") {
 +
$(".sub-navbar").show();
 +
hideNavbars();
 +
$("#navbar-team").show();
 +
} else if ($name == "notebook") {
 +
$(".sub-navbar").show();
 +
hideNavbars();
 +
$("#navbar-notebook").show();
 +
} else if ($name == "project-ubp") {
 +
$(".sub-navbar").show();
 +
hideNavbarsSub();
 +
$("#navbar-project-ubp").show();
 +
} else if ($name == "project-translation") {
 +
$(".sub-navbar").show();
 +
hideNavbarsSub();
 +
$("#navbar-project-translation").show();
 +
} else if ($name == "project-toolbox") {
 +
$(".sub-navbar").show();
 +
hideNavbarsSub();
 +
$("#navbar-project-toolbox").show();
 +
} else if ($name == "results-ubp") {
 +
$(".sub-navbar").show();
 +
hideNavbarsSub();
 +
$("#navbar-results-ubp").show();
 +
} else if ($name == "results-translation") {
 +
$(".sub-navbar").show();
 +
hideNavbarsSub();
 +
$("#navbar-results-translation").show();
 +
} else if ($name == "results-toolbox") {
 +
$(".sub-navbar").show();
 +
hideNavbarsSub();
 +
$("#navbar-results-toolbox").show();
 +
} else if ($name == "results-parts") {
 +
$(".sub-navbar").show();
 +
hideNavbarsSub();
 +
$("#navbar-results-parts").show();
 +
}
 +
 +
    });
 +
});
 +
 +
$(document).ready(function() {
 +
    $(".contentbox").mouseover(function() {
 +
$(".sub-navbar").hide();
 +
hideNavbars();
 +
 +
    });
 +
});
  
  

Revision as of 03:24, 27 August 2017