Team:Shenzhen SFLS/comm/javascripts
From 2013hs.igem.org
(Difference between revisions)
(One intermediate revision not shown) | |||
Line 17: | Line 17: | ||
if(_menuItem[i].submenu.length>0){ | if(_menuItem[i].submenu.length>0){ | ||
for(var j=0;j<_menuItem[i].submenu.length;j++){ | for(var j=0;j<_menuItem[i].submenu.length;j++){ | ||
- | $menu_sub.append('<li><a href=' + _menuItem[i].submenu[j].link + '>' + _menuItem[i].submenu[j].txt + '</a></li>'); | + | $menu_sub.append('<li class="' +_menuItem[i].submenu[j].menu+ '"><a href=' + _menuItem[i].submenu[j].link + '>' + _menuItem[i].submenu[j].txt + '</a></li>'); |
} | } | ||
$menu_context.append($menu_sub); | $menu_context.append($menu_sub); | ||
Line 23: | Line 23: | ||
$menu.append($menu_context); | $menu.append($menu_context); | ||
} | } | ||
- | |||
$('.nav').append($menu); | $('.nav').append($menu); | ||
$('.nav li').hover( | $('.nav li').hover( | ||
Line 42: | Line 41: | ||
$(".nav_sub").slideUp('slow'); | $(".nav_sub").slideUp('slow'); | ||
}); | }); | ||
+ | |||
if(_menuItem[_index].menu=='menu') | if(_menuItem[_index].menu=='menu') | ||
- | $('.nav li').eq(_index).addClass('active_select'); | + | $('.nav li').siblings().eq(_index).addClass('active_select'); |
else | else | ||
- | $('.nav li').eq(_index).addClass('active_parent_select'); | + | $('.nav li').siblings().eq(_index).addClass('active_parent_select'); |
- | + | ||
- | + | ||
} | } |
Latest revision as of 18:07, 21 June 2013
function menu_active(_index) {
var $menu = $('var $menu_context; var _menuItem = [{ 'txt': 'Home','menu':'menu', 'link': 'https://2013hs.igem.org/Team:Shenzhen_SFLS','submenu':[] }, { 'txt': 'Team','menu':'menu', 'link': 'https://2013hs.igem.org/Team:Shenzhen_SFLS/Team','submenu':[] }, { 'txt': 'Project','menu':'menu_parent', 'link': 'https://2013hs.igem.org/Team:Shenzhen_SFLS/Project',
'submenu':[{'txt': 'biosafety','menu':'menu', 'link': 'https://2013hs.igem.org/Team:Shenzhen_SFLS/Biosafety'}] },
{ 'txt': 'Notebook','menu':'menu', 'link': 'https://2013hs.igem.org/Team:Shenzhen_SFLS/Notebook','submenu':[] }, { 'txt': 'Results','menu':'menu', 'link': 'https://2013hs.igem.org/Team:Shenzhen_SFLS/Results' ,'submenu':[]}, { 'txt': 'Human practices','menu':'menu', 'link': 'https://2013hs.igem.org/Team:Shenzhen_SFLS/Human' ,'submenu':[]}];
for (var i = 0; i < _menuItem.length; i++) {$menu_context=$('