Created
April 20, 2011 13:13
-
-
Save paveltyk/931300 to your computer and use it in GitHub Desktop.
jQuery simple tabs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('ul.tab-controls li').bind('click', function() { | |
$(this).addClass('active').siblings().removeClass('active') | |
.parents('#funbox').find('ul.tab').hide().eq($(this).index()).fadeIn(500); | |
return false; | |
}); | |
// HTML: | |
// <div id="funbox"> | |
// <ul class="tab-controls"> | |
// <li class="active"><a href="#">Featured</a></li> | |
// <li><a href="#">Popular</a></li> | |
// <li><a href="#">Archives</a></li> | |
// </ul> | |
// <ul class="tab"><li>Hello from the first tab</li></ul> | |
// <ul class="tab"><li>Hello from the second tab</li></ul> | |
// </div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment