(24 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{CSU_CHINA/Base}} | {{CSU_CHINA/Base}} | ||
+ | {{CSU_CHINA/PageBase}} | ||
+ | |||
+ | |||
<html> | <html> | ||
<style> | <style> | ||
Line 79: | Line 82: | ||
$(document).ready(function() | $(document).ready(function() | ||
{ | { | ||
− | $( | + | |
− | + | let navibar = $('ul.navigation-bar'); | |
− | //highlight current page on the menu | + | let navbuttonItems = $('ul.navigation-bar > li'); |
+ | navbuttonItems.mouseenter(function() | ||
+ | { | ||
+ | var submenu = $(this).children('ul.sub-menu'); | ||
+ | submenu.stop(true,false); | ||
+ | submenu.slideDown(); | ||
+ | }); | ||
+ | navbuttonItems.mouseleave(function() | ||
+ | { | ||
+ | var submenu = $(this).children('ul.sub-menu'); | ||
+ | submenu.stop(true,false); | ||
+ | submenu.slideUp(); | ||
+ | }); | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | //highlight current page on the menu | ||
highlight_current_page_menu(); | highlight_current_page_menu(); | ||
− | + | ||
//accessing submenus | //accessing submenus | ||
$(".menu_item").click(function(){ | $(".menu_item").click(function(){ | ||
Line 94: | Line 114: | ||
$(".igem_2018_team_mobile_bar").click(function(){ | $(".igem_2018_team_mobile_bar").click(function(){ | ||
$(this).next().toggleClass("displaying_menu"); | $(this).next().toggleClass("displaying_menu"); | ||
− | }); | + | }); |
+ | |||
+ | }); | ||
+ | function highlight_current_page_menu() { | ||
+ | |||
+ | var page_url="https://2018.igem.org/"; | ||
+ | page_url = page_url + wgPageName; | ||
+ | $("a[href$='"+ page_url +"']").children().addClass("current_page"); | ||
+ | |||
+ | //if the page is in a submenu, open the submenu and make the appropiate changes | ||
+ | if( $( ".current_page" ).hasClass( "submenu_item" )){ | ||
+ | |||
+ | $(".current_page").parent().parent().fadeToggle(400); | ||
+ | $(".current_page").parent().parent().prev().addClass("current_page"); | ||
+ | $(".menu_item.current_page > .submenu_control_icon").toggleClass("open"); | ||
+ | |||
+ | } | ||
+ | } | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</script> | </script> | ||
Latest revision as of 02:04, 18 October 2018