Difference between revisions of "Template:Team:TU Eindhoven/Menu Script"
Jan Willem (Talk | contribs) |
Jan Willem (Talk | contribs) |
||
Line 1: | Line 1: | ||
<html> | <html> | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
$(document).ready(function() { | $(document).ready(function() { | ||
Line 121: | Line 112: | ||
$("#submenu").css("height", "0"); | $("#submenu").css("height", "0"); | ||
}); | }); | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
! function(d, s, id) { | ! function(d, s, id) { | ||
Line 222: | Line 155: | ||
document.getElementById("contentarrow").style.transform = "rotate(0deg)"; | document.getElementById("contentarrow").style.transform = "rotate(0deg)"; | ||
document.getElementById("contentmenu").style.transform = "translateX(-90%) scale(1,0.4)"; | document.getElementById("contentmenu").style.transform = "translateX(-90%) scale(1,0.4)"; | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
</html> | </html> |
Revision as of 12:56, 21 July 2015
$(document).ready(function() { //background $("
").appendTo("body");
$('').appendTo("#background");
var a = 0;
$("#twitter_logo,#twitter").hover(
function() {
$("#twitter").css("z-index", "2");
},
function() {
$("#twitter").css("z-index", "-1");
});
$("#facebook_logo,#facebook").hover(
function() {
$("#facebook").css("z-index", "2");
},
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;
});
$("#submenuwrapper").hover(
function() {
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() {
$("#submenu").css("height", "0");
$("#menu1,#menu2,#menu3,#menu4,#menu5,#menu6").css("color", "#004415");
});
$("#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() {
$("#menu1,#menu2,#menu3,#menu4,#menu5,#menu6").css("color", "#004415");
$("#submenu").css("height", "0");
});
! 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
if (sessionStorage.hidden == "" || sessionStorage.hidden == "1") {
direct_hide();
}
});
function toggle_hide() {
document.getElementById("contentmenu").style.transition = "transform 0.5s";
if (sessionStorage.hidden != "1") {
document.getElementById("contentmenu").style.transform = "translateX(-90%) scale(1,0.4)";
document.getElementById("contentarrow").style.transform = "rotate(0deg)";
sessionStorage.hidden = "1";
} else {
document.getElementById("contentmenu").style.transform = "translateX(0) scale(1,1)";
document.getElementById("contentarrow").style.transform = "rotate(180deg)";
sessionStorage.hidden = "0";
}
}
function direct_hide() {
document.getElementById("contentarrow").style.transform = "rotate(0deg)";
document.getElementById("contentmenu").style.transform = "translateX(-90%) scale(1,0.4)";
}