Difference between revisions of "Template:Team:TU Eindhoven/Menu Script"
Line 172: | Line 172: | ||
//reset alles en display dan alleen de juiste | //reset alles en display dan alleen de juiste | ||
$("#menu1,#menu2,#menu3,#menu4,#menu5,#menu6").css("color", "#004415"); | $("#menu1,#menu2,#menu3,#menu4,#menu5,#menu6").css("color", "#004415"); | ||
− | $("#sub2,#sub3,#sub4,#sub5").css( | + | $("#sub2,#sub3,#sub4,#sub5").css("display","none"); |
switch (a) { | switch (a) { | ||
case 1: | case 1: | ||
Line 180: | Line 180: | ||
case 2: | case 2: | ||
$("#menu2").css("color", "#9DC671"); | $("#menu2").css("color", "#9DC671"); | ||
− | $("#sub2").css( | + | $("#sub2").css("display","block"); |
$("#submenu").css("height", "60px"); | $("#submenu").css("height", "60px"); | ||
break; | break; | ||
case 3: | case 3: | ||
$("#menu3").css("color", "#9DC671"); | $("#menu3").css("color", "#9DC671"); | ||
− | $("#sub3").css( | + | $("#sub3").css("display","block"); |
$("#submenu").css("height", "60px"); | $("#submenu").css("height", "60px"); | ||
break; | break; | ||
case 4: | case 4: | ||
$("#menu4").css("color", "#9DC671"); | $("#menu4").css("color", "#9DC671"); | ||
− | $("#sub4").css( | + | $("#sub4").css("display","block"); |
$("#submenu").css("height", "60px"); | $("#submenu").css("height", "60px"); | ||
break; | break; | ||
case 5: | case 5: | ||
$("#menu5").css("color", "#9DC671"); | $("#menu5").css("color", "#9DC671"); | ||
− | $("#sub5").css( | + | $("#sub5").css("display","block"); |
$("#submenu").css("height", "60px"); | $("#submenu").css("height", "60px"); | ||
break; | break; | ||
Line 217: | Line 217: | ||
} | } | ||
else{ | else{ | ||
+ | a = submenu; | ||
if (submenu == 1 || submenu == 6 ){ | if (submenu == 1 || submenu == 6 ){ | ||
$("#submenu").css("height", "0"); | $("#submenu").css("height", "0"); | ||
$("#menu1,#menu2,#menu3,#menu4,#menu5,#menu6").css("color", "#004415"); | $("#menu1,#menu2,#menu3,#menu4,#menu5,#menu6").css("color", "#004415"); | ||
− | $("#sub2,#sub3,#sub4,#sub5").css( | + | $("#sub2,#sub3,#sub4,#sub5").css("display""none"); |
$("#menu"+submenu.toString()).css("color", "#9DC671"); | $("#menu"+submenu.toString()).css("color", "#9DC671"); | ||
} | } | ||
else{ | else{ | ||
− | $("#sub2,#sub3,#sub4,#sub5").css( | + | $("#sub2,#sub3,#sub4,#sub5").css("display","none"); |
$("#submenu").css("height", "60px"); | $("#submenu").css("height", "60px"); | ||
$("#menu1,#menu2,#menu3,#menu4,#menu5,#menu6").css("color", "#004415"); | $("#menu1,#menu2,#menu3,#menu4,#menu5,#menu6").css("color", "#004415"); | ||
− | $("#sub"+submenu.toString()).css( | + | $("#sub"+submenu.toString()).css("display","block"); |
$("#menu"+submenu.toString()).css("color", "#9DC671"); | $("#menu"+submenu.toString()).css("color", "#9DC671"); | ||
} | } |
Revision as of 13:24, 25 August 2015
$(document).ready(function() { //uitklap zooi van hans JW is een BITCH HANS is CRACKIE $('.spoilerbutton').click(function() { var id = "spoiler" + $(this).attr("id").match(/\d+/); if ($(this).attr("src").indexOf("Uitgeklapt") != -1) { $(this).attr("src","https://static.igem.org/mediawiki/2015/8/87/TU_Eindhoven_Ingeklapt.png"); $('#' + id).slideToggle(); } else { $(this).attr("src","https://static.igem.org/mediawiki/2015/6/65/TU_Eindhoven_Uitgeklapt.png"); $('#' + id).slideToggle(); }; var element = $(this); element.css("pointer-events","none"); setTimeout(function(){element.css("pointer-events","auto")},400); }); //scroll zooi van hans jQuery(window).on("hashchange", function () { window.scrollTo(window.scrollX, window.scrollY - 100); }); // Get current Page locus=$(location).attr('pathname'); submenu = 0; switch (locus) { case '/Team:TU_Eindhoven': submenu = 1; break; case '/Team:TU_Eindhoven/Team': submenu = 2; break; case '/Team:TU_Eindhoven/Team/Members': submenu = 2; break; case '/Team:TU_Eindhoven/Team/Supervisors': submenu = 2; break; case '/Team:TU_Eindhoven/Attributions': submenu = 2; break; case '/Team:TU_Eindhoven/Description': submenu = 3; break; case '/Team:TU_Eindhoven/Project/Design': submenu = 3; break; case '/Team:TU_Eindhoven/Project/Experimental_Approach': submenu = 3; break; case '/Team:TU_Eindhoven/Notebook': submenu = 3; break; case '/Team:TU_Eindhoven/Project/Interlab': submenu = 3; break; case '/Team:TU_Eindhoven/Practices': submenu = 4; break; case '/Team:TU_Eindhoven/Policy_Practices/Timeline': submenu = 4; break; case '/Team:TU_Eindhoven/Policy_Practices/Educational_outreach': submenu = 4; break; case '/Team:TU_Eindhoven/Policy_Practices/Application_scenarios': submenu = 4; break; case '/Team:TU_Eindhoven/Collaborations': submenu = 5; break; case '/Team:TU_Eindhoven/Collaborations/CloningGuide': submenu = 5; break; case '/Team:TU_Eindhoven/Collaborations/AmoyNewsletter': submenu = 5; break; case '/Team:TU_Eindhoven/Team/Sponsors': submenu = 6; break; }; // "submenu" contains the number of the submenu to be shown by default (or 0 for none). // icon var link = document.createElement('link'); link.type = 'image/x-icon'; link.rel = 'shortcut icon'; link.href = 'https://static.igem.org/mediawiki/2015/4/4a/Logo_Eindhoven_small.png'; document.getElementsByTagName('head')[0].appendChild(link); //background $("