Difference between revisions of "Template:Team:TU Eindhoven/Menu Script"

Line 204: Line 204:
 
         },
 
         },
 
         function() {
 
         function() {
        setTimeout(function(){
+
 
     if (subhover == 0) {
+
      
 
         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");}
         else{ $("#sub"+submenu.toString()).css("display", "block");
+
         else{ setTimeout(function(){ if (subhover == 0) { $("#sub"+submenu.toString()).css("display", "block");
               $("#submenu").css("height", "60px");
+
               $("#submenu").css("height", "60px"); }; },1);
}; }; },1);
+
}; 
 
         });
 
         });
  

Revision as of 21:29, 24 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); }); // 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 $("

").appendTo("body"); $('').appendTo("#background"); var a = 0; $("#twitter_logo,#twitter").hover( function() { $("#twitter").css("z-index", "10"); }, function() { $("#twitter").css("z-index", "-1"); }); $("#facebook_logo,#facebook").hover( function() { $("#facebook").css("z-index", "10"); }, function() { $("#facebook").css("z-index", "-1"); }); $("#menu1").hover( function() { a = 1; }); $("#menu2").hover( function() { a = 2; }); $("#menu3").hover( function() { a = 3; }); $("#menu4").hover( function() { a = 4; }); $("#menu5").hover( function() { a = 5; }); $("#menu6").hover( function() { a = 6; }); locus=$(location).attr('pathname'); subhover = 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/Team/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; }; $("#submenuwrapper").hover( function() { subhover = 1; switch (a) { case 2: $("#menu2").css("color", "#9DC671"); $("#submenu").css("height", "60px"); break; case 3: $("#menu3").css("color", "#9DC671"); $("#submenu").css("height", "60px"); break; case 4: $("#menu4").css("color", "#9DC671"); $("#submenu").css("height", "60px"); break; case 5: $("#menu5").css("color", "#9DC671"); $("#submenu").css("height", "60px"); break; } }, function() { subhover = 0; if (submenu == 1 || submenu == 6){ $("#submenu").css("height", "0"); $("#menu1,#menu2,#menu3,#menu4,#menu5,#menu6").css("color", "#004415");} else{ $("#sub2,#sub3,#sub4,#sub5").css("display", "none"); $("#sub"+submenu.toString()).css("display", "block"); $("#submenu").css("height", "60px"); } }); $("#menu1,#menu2,#menu3,#menu4,#menu5,#menu6").hover( function() { //reset alles en display dan alleen de juiste $("#menu1,#menu2,#menu3,#menu4,#menu5,#menu6").css("color", "#004415"); $("#sub2,#sub3,#sub4,#sub5").css("display", "none"); switch (a) { case 1: $("#menu1").css("color", "#9DC671"); break; case 2: $("#menu2").css("color", "#9DC671"); $("#sub2").css("display", "block"); $("#submenu").css("height", "60px"); break; case 3: $("#menu3").css("color", "#9DC671"); $("#sub3").css("display", "block"); $("#submenu").css("height", "60px"); break; case 4: $("#menu4").css("color", "#9DC671"); $("#sub4").css("display", "block"); $("#submenu").css("height", "60px"); break; case 5: $("#menu5").css("color", "#9DC671"); $("#sub5").css("display", "block"); $("#submenu").css("height", "60px"); break; case 6: $("#menu6").css("color", "#9DC671"); break; } }, function() { if (submenu == 1 || submenu == 6){ $("#submenu").css("height", "0"); $("#menu1,#menu2,#menu3,#menu4,#menu5,#menu6").css("color", "#004415");} else{ setTimeout(function(){ if (subhover == 0) { $("#sub"+submenu.toString()).css("display", "block"); $("#submenu").css("height", "60px"); }; },1); }; }); ! function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https'; if (!d.getElementById(id)) { js = d.createElement(s); js.id = id; js.src = p + "://platform.twitter.com/widgets.js"; fjs.parentNode.insertBefore(js, fjs); } }(document, "script", "twitter-wjs"); (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1&version=v2.3"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); //Content Menu $("#contentToggle").css("height",$("#infoTab").height()); $("#infoTabContent").css("height",$("#infoTabContent").height()); if(sessionStorage.getItem('contentMenu') == null){ sessionStorage.contentMenu = "true"; } else{ contentMenuCheck(); } $("#contentToggle").click(function(){ if(sessionStorage.contentMenu == "true"){ $("#infoTab").css("transition","transform 1s"); $("#infoTab").css("transform","translate(-80%,0)"); $("#contentToggleImg").css("transform","rotate(180deg)"); sessionStorage.contentMenu = "false"; } else{ $("#infoTab").css("transition","transform 1s"); $("#infoTab").css("transform","translate(0,0)"); $("#contentToggleImg").css("transform","rotate(0deg)"); sessionStorage.contentMenu = "true"; } }); $(".contentMenuImg").click( function(){ if($("#contentList" + $(this).attr("id").match(/\d+/)).is(":visible")){ $("#contentMenuImg" + $(this).attr("id").match(/\d+/)).css("transform","rotate(0deg)"); } else{ $("#contentMenuImg" + $(this).attr("id").match(/\d+/)).css("transform","rotate(180deg)"); } $("#contentList" + $(this).attr("id").match(/\d+/)).slideToggle(); var el = $(this); el.css("pointer-events", "none"); setTimeout(function(){el.css("pointer-events","auto")},400); } ) }); function contentMenuCheck() { if(sessionStorage.contentMenu == "false"){ $("#infoTab").css("transition","none"); $("#infoTab").css("transform","translate(-80%,0)"); $("#contentToggleImg").css("transform","rotate(180deg)"); } }