Team:Shenzhen SFLS/comm/javascripts

From 2013hs.igem.org

(Redirected from Team:Shenzhen SFLS/project)

function menu_active(_index) {

var $menu = $('
    '); var $menu_sub=$('');;
       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=$('
  • </li>'); $menu_context.append('<a href=' + _menuItem[i].link + '>' + _menuItem[i].txt + '</a>'); if(_menuItem[i].submenu.length>0){ for(var j=0;j<_menuItem[i].submenu.length;j++){ $menu_sub.append('
  • <a href=' + _menuItem[i].submenu[j].link + '>' + _menuItem[i].submenu[j].txt + '</a></li>'); } $menu_context.append($menu_sub); } $menu.append($menu_context); } $('.nav').append($menu); $('.nav li').hover( function () { if(_menuItem[$(this).index()].menu=='menu') $(this).addClass('active'); else $(this).addClass('active_parent'); }, function () { $(this).removeClass('active'); $(this).removeClass('active_parent'); }); $('.nav .menu_parent,.nav .active_parent,.nav .active_parent_select').hover( function () { $(".nav_sub").slideDown('fast').show(); }, function () { $(".nav_sub").slideUp('slow'); }); if(_menuItem[_index].menu=='menu') $('.nav li').siblings().eq(_index).addClass('active_select'); else $('.nav li').siblings().eq(_index).addClass('active_parent_select'); }