Skip to content

Instantly share code, notes, and snippets.

@RStankov
Forked from joneff/Proto.Tabs.js
Created September 2, 2009 22:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RStankov/180007 to your computer and use it in GitHub Desktop.
Save RStankov/180007 to your computer and use it in GitHub Desktop.
<div class="tab-panel">
<nav class="tabs">
<ul>
<li href="#sect-1" tabindex="1">tab 1</li>
<li href="#sect-2" tabindex="2">tab 2</li>
<li href="#sect-3" tabindex="3">tab 3</li>
</ul>
</nav>
<section id="sect-1"></section>
<section id="sect-2"></section>
<section id="sect-3"></section>
</div>
<script>
document.delegate("nav.tabs li", "focus:in", function(event){
Event.stop(event);
this.addClassName("selected").siblings().invoke("removeClassName", "selected");
var target = $(this.href.substring(tab.href.indexOf("#") + 1));
if (target) target.show().siblings().slice(0).invoke("hide");
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment