Team:Shenzhen SFLS/comm/javascripts
From 2013hs.igem.org
(Difference between revisions)
Line 1: | Line 1: | ||
+ | var menu_active = function (_index) { | ||
+ | $('.nav li').removeClass('active1'); | ||
+ | $('.nav li').eq(_index).addClass('active1'); | ||
+ | } | ||
$(document).ready(function () { | $(document).ready(function () { | ||
- | + | var $menu_sub = $('<ul></ul>'); | |
- | + | var _menuItem = [{ 'txt': 'Home', 'link': 'index.html' }, { 'txt': 'Team', 'link': 'team.html' }, { 'txt': 'Project', 'link': 'team.html' } | |
- | + | , { 'txt': 'Notebook', 'link': 'team.html' }, { 'txt': 'Protocols', 'link': 'team.html' }, { 'txt': 'Human practices', 'link': 'team.html' }]; | |
- | + | for (var i = 0; i < _menuItem.length; i++) { | |
- | + | $menu_sub.append('<li><a href=' + _menuItem[i].link + '>' + _menuItem[i].txt + '</a></li>'); | |
- | + | } | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | $('.nav').append($menu_sub); | |
- | + | $('.nav li').hover( | |
+ | function () { | ||
+ | $(this).addClass('active'); | ||
+ | }, function () { | ||
+ | $('.nav li').removeClass('active'); | ||
+ | }); | ||
+ | |||
+ | |||
+ | }); |
Revision as of 10:35, 13 June 2013
var menu_active = function (_index) {
$('.nav li').removeClass('active1'); $('.nav li').eq(_index).addClass('active1');
} $(document).ready(function () {
var $menu_sub = $('var _menuItem = [{ 'txt': 'Home', 'link': 'index.html' }, { 'txt': 'Team', 'link': 'team.html' }, { 'txt': 'Project', 'link': 'team.html' } , { 'txt': 'Notebook', 'link': 'team.html' }, { 'txt': 'Protocols', 'link': 'team.html' }, { 'txt': 'Human practices', 'link': 'team.html' }];
for (var i = 0; i < _menuItem.length; i++) {$menu_sub.append('