Difference between revisions of "Template:Team:DTU-Denmark/index.html"

Line 74: Line 74:
 
             #headerWrapper a:visited,
 
             #headerWrapper a:visited,
 
             #headerWrapper a:active {
 
             #headerWrapper a:active {
                 text-decoration:none;
+
                 /*text-decoration:none;*/
 
                 color:black;
 
                 color:black;
 
             }
 
             }
Line 159: Line 159:
 
             }
 
             }
  
             li#current-navigation > a {
+
             li#current-navigation a {
 
             background-color:#990000;
 
             background-color:#990000;
 
             color:white;
 
             color:white;
Line 746: Line 746:
  
 
<script>
 
<script>
$(document).ready(window.onmouseover=function(e) {
+
// Function to find an show current head and sub menue.
var navig = e.target.className
+
var show_current_sub = function(){
navig = navig.split(" ")[0]
+
navig = navig + "-sub"
+
var current_sub_bar = document.getElementById(navig)
+
 
+
if (current_sub_bar !== null){
+
var last_sub_bar = document.getElementsByClassName("active-sub")
+
$(".active-sub").removeClass("active-sub");
+
current_sub_bar.className = "active-sub";
+
    }
+
});
+
 
+
window.onload = function (){
+
 
var current_url = window.location.href
 
var current_url = window.location.href
 
var search_name = "a[href=\'" + current_url + "\']"
 
var search_name = "a[href=\'" + current_url + "\']"
Line 779: Line 767:
 
current_sub_bar.className = "active-sub";
 
current_sub_bar.className = "active-sub";
 
}
 
}
 
 
}
 
}
 +
 +
// Clear sub menues
 +
var empty_sub = function(){
 +
var last_sub_bar = document.getElementsByClassName("active-sub")
 +
$(".active-sub").removeClass("active-sub");
 +
}
 +
 +
// Open sub menues
 +
$(document).ready(window.onmouseover=function(e) {
 +
var navig = e.target.className
 +
navig = navig.split(" ")[0]
 +
navig = navig + "-sub"
 +
var current_sub_bar = document.getElementById(navig)
 +
 +
if (current_sub_bar !== null){
 +
empty_sub()
 +
current_sub_bar.className = "active-sub";
 +
    }
 +
});
 +
 +
// Open current sub menue when the window opens
 +
window.onload = function (){
 +
show_current_sub()
 +
}
 +
 +
// Go back to current sub menue
 +
$("div#headerWrapper").mouseleave(function(){
 +
empty_sub()
 +
    show_current_sub()
 +
});
 +
 
</script>
 
</script>
  

Revision as of 11:39, 5 August 2016

New HTML template for the wiki