Skip to content

Instantly share code, notes, and snippets.

@RStankov
Forked from joneff/Proto.Tabs.js
Created September 2, 2009 13:43
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/179719 to your computer and use it in GitHub Desktop.
Save RStankov/179719 to your computer and use it in GitHub Desktop.
//= require "http://gist.github.com/66568"
//= require "http://gist.github.com/162593"
<div class="tab-panel">
<nav class="tabs">
<ul>
<li href="#sect-1" tagindex="1">tab 1</li>
<li href="#sect-2" tagindex="2">tab 2</li>
<li href="#sect-3" tagindex="3">tab 3</li>
</ul>
</nav>
<section id="sect-1"></section>
<section id="sect-2" style="display:none;"></section>
<section id="sect-3" style="display:none;></section>
</div>
<script>
document.delegate('nav.tabs li', 'focus:in', function(e){
e.stop();
this.siblings().invoke("removeClassName", "selected");
this.addClassName("selected");
var target = $(this.href.substring(this.href.indexOf("#") + 1));
if (target){
target.siblings().invoke("hide");
target.show();
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment