Skip to content

Instantly share code, notes, and snippets.

@RStankov
Created September 1, 2009 19:33
Show Gist options
  • Save RStankov/179320 to your computer and use it in GitHub Desktop.
Save RStankov/179320 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>
<ul>
<li class="tab selected" tabindex="1">tab 1</li>
<li class="tab" tabindex="2">tab 2</li>
<li class="tab" tabindex="3">tab 3</li>
</ul>
</nav>
<section></section>
<section style="display: none;"></section>
<section style="display: none;"></section>
</div>
document.delegate('.tab_panel .tab', 'focus:in', function(){
this.up('.tab_panel').select('section').invoke('hide')[this.previousSiblings('.tab').length].show();
this.up().select('.selected').invoke('removeClassName', 'selected');
this.addClassName('selected');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment