Line 20: | Line 20: | ||
#content{ width: 100%; margin: 0; padding: 0;} | #content{ width: 100%; margin: 0; padding: 0;} | ||
− | + | /* Makes up for standart css on the wiki*/ | |
− | #globalWrapper, #content { | + | #globalWrapper, #content { |
width: 100%; | width: 100%; | ||
height: 100%; | height: 100%; | ||
Line 50: | Line 50: | ||
} | } | ||
− | + | #headerWrapper #current-navigation a { | |
background-color:#750000; | background-color:#750000; | ||
− | + | color:white; | |
} | } | ||
#Topnav { | #Topnav { | ||
− | + | background-color: white; | |
} | } | ||
+ | #Topnav a:hover, | ||
#Topnav a.hover, | #Topnav a.hover, | ||
#headerWrapper #current-navigation a.hover{ | #headerWrapper #current-navigation a.hover{ | ||
Line 76: | Line 77: | ||
.nav-item { | .nav-item { | ||
− | + | float: left; | |
line-height: 65px; | line-height: 65px; | ||
padding: 10px 10px 0px 10px; | padding: 10px 10px 0px 10px; | ||
Line 83: | Line 84: | ||
− | + | /*Dimensions and placement of logo*/ | |
#logo { | #logo { | ||
float: left; | float: left; | ||
Line 100: | Line 101: | ||
/* do not show mobile interactions*/ | /* do not show mobile interactions*/ | ||
.mobile-menue { | .mobile-menue { | ||
− | + | display: none; | |
} | } | ||
Line 122: | Line 123: | ||
#sub-navigation { | #sub-navigation { | ||
− | + | color:white; | |
text-align: right; | text-align: right; | ||
font-size: 0.9em; | font-size: 0.9em; | ||
Line 168: | Line 169: | ||
#headerWrapper { | #headerWrapper { | ||
− | + | background-color:white; | |
− | + | } | |
− | + | ||
− | + | #headerWrapper #current-navigation a { | |
− | + | background-color:transparent; | |
− | + | color:black; | |
− | + | } | |
− | + | #Topnav a.hover, | |
− | + | #headerWrapper #current-navigation a.hover{ | |
− | + | background-color: #990000; | |
− | + | color: white; | |
− | + | } | |
− | + | #navigation { | |
− | + | margin: 0px 36px 0px 0px; | |
− | + | background-color: white; | |
− | + | /*display: none;*/ | |
− | + | float: none; | |
− | + | text-align: center; | |
− | + | } | |
− | + | .nav-item { | |
− | + | width: 100%; | |
− | + | float: none; | |
− | + | display: none; | |
− | + | line-height: 40px; | |
− | + | padding: 0px; | |
− | + | border-bottom: 1px solid #990000; | |
− | + | } | |
− | + | /*Dimensions and placement of logo*/ | |
− | + | #logo { | |
− | + | width: 100%; | |
− | + | float: left; | |
− | + | height: 85px; | |
− | + | padding-top: 15px; /* control that it is below the iGEM topbar*/ | |
− | + | margin-bottom: 0px; | |
− | + | border-bottom: 3px solid #990000; | |
− | + | } | |
− | + | ||
− | + | #logo img.BioBuilders{ | |
− | + | width: 110px; | |
− | + | background: transparent; | |
− | + | margin-top: 2px; | |
− | + | margin-bottom: 2px; | |
− | + | padding-right: 0px; | |
− | + | } | |
− | + | /* Display mobile menue*/ | |
− | + | .mobile-menue { | |
− | + | margin: 25px 10px; | |
− | + | display: inline; | |
− | + | float: right; | |
− | + | } | |
− | + | #arrow{ | |
− | + | display: none; | |
− | + | } | |
− | + | ||
− | + | ||
− | + | /*Text of sub nav*/ | |
− | + | #sub-navigation-wrapper a { | |
− | + | text-decoration:none; | |
− | + | color:black; | |
− | + | } | |
− | + | ||
− | + | /*Dimensions and look of sub nav*/ | |
− | + | #sub-navigation-wrapper { | |
− | + | clear:both; | |
− | + | position:relative; | |
− | + | background-color: white; | |
− | + | color: white; | |
− | + | height: 0px; | |
− | + | padding-top: 7px; | |
− | + | -webkit-box-shadow: 0px 0px 0px 0px rgba(50, 50, 50, 0.75); | |
− | + | -moz-box-shadow: 0px 0px 0px 0px rgba(50, 50, 50, 0.75); | |
− | + | box-shadow: 0px 0px 0px 0px rgba(50, 50, 50, 0.75); | |
− | + | } | |
− | + | #sub-navigation { | |
− | + | width: 100%; | |
− | + | color:white; | |
− | + | text-align: center; | |
− | + | font-size: 0.9em; | |
− | + | position: fixed; | |
− | + | margin-top: -3px; | |
− | + | font-weight:200; | |
− | + | } | |
− | + | #sub-navigation li { | |
− | + | margin: 0px 37px 0px 0px; | |
− | + | display: block; | |
− | + | } | |
− | + | .sub-nav-item{ | |
− | + | line-height: 40px; | |
− | + | padding: 0px; | |
− | + | } | |
− | + | /* Only show active subs */ | |
− | + | #sub-navigation > ul { | |
− | + | display:none; | |
− | + | } | |
− | + | /* This makes the seperators between the sub-navigation elements */ | |
− | + | #sub-navigation li:before{ | |
− | + | content:""; | |
− | + | padding:0px; | |
− | + | color:black; | |
− | + | } | |
− | + | } | |
Line 307: | Line 308: | ||
<button id="arrow" class="mobile-menue">⇦</button> | <button id="arrow" class="mobile-menue">⇦</button> | ||
− | + | ||
Line 390: | Line 391: | ||
− | + | <script> | |
− | + | // Update window when page resizes. | |
− | + | var windowWidth = $(window).width(); | |
− | + | $(window).resize(function() { | |
− | + | // Only activate when it changes to moblie navigation. | |
− | + | if(windowWidth < 650){ | |
− | + | if($(window).width() > 650 ){ | |
− | + | location.reload(); | |
− | + | return; | |
− | + | } | |
− | + | } | |
− | + | if(windowWidth > 650){ | |
− | + | if($(window).width() < 650 ){ | |
− | + | location.reload(); | |
− | + | return; | |
− | + | } | |
− | + | } | |
− | + | }); | |
− | + | if ( $(window).width() > 650 ){ | |
− | + | // Function to find an show current head and sub menue. | |
− | + | var show_current_sub = function(){ | |
− | + | var current_url = window.location.href | |
current_url = current_url.split("#")[0] | current_url = current_url.split("#")[0] | ||
− | + | var search_name = "a[href=\'" + current_url + "\']" | |
− | + | var position_link = document.querySelectorAll(search_name); | |
− | + | var link_p1 = $(position_link).parent(); | |
− | + | var link_p2 = $(link_p1).parent(); | |
− | + | var link_p3 = $(link_p2).parent(); | |
− | + | if(link_p2.attr('id') == "nav-items"){ | |
− | + | position_link[0].className += " hover" | |
− | + | link_p1[0].id = "current-navigation"; | |
− | + | for (var i = 0; i < position_link.length; i++) { | |
− | + | var name = position_link[i].id; | |
− | + | } | |
− | + | var sub_name = name + "-sub"; | |
− | + | var current_sub_bar = document.getElementById(sub_name) | |
− | + | current_sub_bar.className = "active-sub"; | |
− | + | } | |
− | + | if(link_p3.attr('id') == "sub-navigation"){ | |
− | + | link_p2[0].className = "active-sub"; | |
− | + | position_link[0].style.fontWeight = "bold"; | |
− | + | var head_name = link_p2[0].id; | |
− | + | head_name = head_name.substring(0, head_name.length - 4); | |
− | + | var current_head_a = document.getElementById(head_name); | |
− | + | current_head_a.className += " hover" | |
− | + | current_head_li = $(current_head_a).parent(); | |
− | + | current_head_li[0].id = "current-navigation"; | |
− | + | } | |
− | + | } | |
− | + | // Clear sub menues | |
− | + | var empty_sub = function(){ | |
− | + | var last_sub_bar = document.getElementsByClassName("active-sub") | |
− | + | $(".active-sub").removeClass("active-sub"); | |
− | + | $(".hover").removeClass("hover"); | |
− | + | } | |
− | + | // Open sub menue function | |
− | + | var open_sub = function(cName){ | |
− | + | cName = cName.split(" ")[0] | |
− | + | navig = cName + "-sub" | |
− | + | var current_sub_bar = document.getElementById(navig) | |
− | + | if (current_sub_bar !== null){ | |
− | + | empty_sub() | |
− | + | $("." + cName).addClass("hover"); | |
− | + | current_sub_bar.className = "active-sub"; | |
− | + | } | |
− | + | } | |
− | + | // open submenues on hover with delay | |
− | + | var timer; | |
− | + | var delay = 400; | |
− | + | $(window).hover( function(event) { | |
− | + | // on mouse in, start a timeout | |
− | + | timer = setTimeout(function(){ | |
− | + | var cName = event.target.className | |
− | + | open_sub(cName) | |
− | + | }, delay); | |
− | + | }, function() { | |
− | + | // on mouse out, cancel the timer | |
− | + | clearTimeout(timer); | |
− | + | }); | |
− | + | // Header menue function on tuch screen | |
− | + | flag = false | |
− | + | $("#navigation").bind('touchstart', function(event){ | |
− | + | if (!flag) { | |
− | + | // prevents multiple clicks | |
− | + | flag = true; | |
− | + | setTimeout(function(){ flag = false; }, 100); | |
− | + | // Find sub menue | |
− | + | var cName = event.target.className.split(" ")[0] | |
− | + | var subName = cName + "-sub" | |
− | + | var subClass = $("#" + subName).attr("class"); | |
− | + | // if sub is not open it is opened. Otherwise the link is used. | |
− | + | if(subClass !== "active-sub"){ | |
− | + | event.preventDefault(); | |
− | + | open_sub( cName ); | |
− | + | } | |
− | + | } | |
− | + | }); | |
− | + | ||
− | + | // Open current sub menue when the window opens | |
− | + | $(document).ready( function (){ | |
− | + | show_current_sub() | |
− | + | }); | |
− | + | // Go back to current sub menue | |
− | + | var timer_leave; | |
− | + | $("div#headerWrapper").hover( function() { | |
− | + | // on mouse in, start a timeout | |
− | + | clearTimeout(timer_leave); | |
+ | }, function() { | ||
+ | // on mouse out, cancel the timer | ||
+ | timer_leave = setTimeout(function(){ | ||
+ | empty_sub() | ||
+ | show_current_sub() | ||
+ | }, delay); | ||
+ | }); | ||
− | + | } else{ | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | // Open moblie menue | |
+ | var flag = false | ||
+ | var menu_open = false | ||
− | + | $("#hamburger").click(function(){ | |
− | + | if (!flag) { | |
− | + | // prevents multiple clicks | |
+ | flag = true; | ||
+ | setTimeout(function(){ flag = false; }, 100); | ||
− | + | if (menu_open){ | |
− | + | $(".nav-item").css("display","none") | |
− | + | menu_open = false | |
− | + | $("#headerWrapper").css("height", "") | |
− | + | } else{ | |
+ | $(".nav-item").css("display","block") | ||
+ | menu_open = true | ||
+ | $("#headerWrapper").css("height", "100%") | ||
+ | } | ||
+ | $("#arrow").css("display","none"); | ||
+ | } | ||
+ | }); | ||
− | + | // Choose in mobile menue | |
− | + | var sub_closed = true | |
− | + | flag = false | |
− | + | $("#navigation").click(function(event){ | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | if (!flag) { | |
− | + | // prevents multiple clicks | |
− | + | flag = true; | |
− | + | setTimeout(function(){ flag = false; }, 100); | |
− | + | ||
− | + | if (sub_closed){ | |
− | + | event.preventDefault(); | |
− | + | name = event.target.id; | |
− | + | $(".nav-item").css("display","none"); | |
− | + | $("#" + name).css("display","block"); | |
− | + | sub_closed = false | |
− | + | $("#" + name + "-sub").css("display","block"); | |
− | + | $("#arrow").css("display","block"); | |
− | + | } | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | $("#hamburger").click(function(){ | |
− | + | sub_closed = true | |
− | + | $("#" + name + "-sub").css("display","none"); | |
− | + | }); | |
− | + | $("#arrow").click(function(){ | |
− | + | sub_closed = true | |
− | + | $("#" + name + "-sub").css("display","none"); | |
− | + | $(".nav-item").css("display","block"); | |
− | + | $("#arrow").css("display","none"); | |
− | + | }); | |
− | + | } | |
− | + | }); | |
− | + | } | |
− | + | </script> | |
− | + | <!-- bootstrap javascript--> | |
− | + | <script type="text/javascript" src="https://2016.igem.org/Team:DTU-Denmark/bootstrap-js?action=raw&ctype=text/javascript"></script> | |
</body> | </body> | ||
</html> | </html> |
Revision as of 10:47, 25 August 2016