Team:TU Munich/lab/notebook
From 2011.igem.org
(Difference between revisions)
Line 1: | Line 1: | ||
{{Team:TU_Munich/Header}} | {{Team:TU_Munich/Header}} | ||
<html> | <html> | ||
+ | <head> | ||
+ | $(function () { | ||
+ | var tabContainers = $('div.tabs > div'); | ||
+ | |||
+ | $('div.tabs ul.tabNavigation a').click(function () { | ||
+ | tabContainers.hide().filter(this.hash).show(); | ||
+ | |||
+ | $('div.tabs ul.tabNavigation a').removeClass('selected'); | ||
+ | $(this).addClass('selected'); | ||
+ | |||
+ | return false; | ||
+ | }).filter(':first').click(); | ||
+ | }); | ||
+ | $(function () { | ||
+ | var tabs = []; | ||
+ | var tabContainers = []; | ||
+ | $('ul.tabs a').each(function () { | ||
+ | // note that this only compares the pathname, not the entire url | ||
+ | // which actually may be required for a more terse solution. | ||
+ | if (this.pathname == window.location.pathname) { | ||
+ | tabs.push(this); | ||
+ | tabContainers.push($(this.hash).get(0)); | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | $(tabs).click(function () { | ||
+ | // hide all tabs | ||
+ | $(tabContainers).hide().filter(this.hash).show(); | ||
+ | |||
+ | // set up the selected class | ||
+ | $(tabs).removeClass('selected'); | ||
+ | $(this).addClass('selected'); | ||
+ | |||
+ | return false; | ||
+ | }); | ||
+ | }); | ||
+ | </head> | ||
<body> | <body> | ||
<div id="labbook" class="content"> | <div id="labbook" class="content"> |
Revision as of 11:01, 14 September 2011
$(function () { var tabContainers = $('div.tabs > div'); $('div.tabs ul.tabNavigation a').click(function () { tabContainers.hide().filter(this.hash).show(); $('div.tabs ul.tabNavigation a').removeClass('selected'); $(this).addClass('selected'); return false; }).filter(':first').click(); }); $(function () { var tabs = []; var tabContainers = []; $('ul.tabs a').each(function () { // note that this only compares the pathname, not the entire url // which actually may be required for a more terse solution. if (this.pathname == window.location.pathname) { tabs.push(this); tabContainers.push($(this.hash).get(0)); } }); $(tabs).click(function () { // hide all tabs $(tabContainers).hide().filter(this.hash).show(); // set up the selected class $(tabs).removeClass('selected'); $(this).addClass('selected'); return false; }); });