-
-
Save Grawl/6533711 to your computer and use it in GitHub Desktop.
Simple and easy to use tabs with jQuery
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
$(document).ready(function(){ | |
$(".tabs-menu li:first, .tabs-content:first").addClass("active"); | |
$(".tabs-content:not(:first)").hide(); | |
$(".tabs-menu > li > a").click(function(e){ | |
var index = $('.tabs-menu li').index($(this).parent('li')); | |
$('.tabs-menu li.active, .tabs-content.active').removeClass('active'); | |
$(this).parent('li').addClass('active'); | |
$('.tabs-content').hide(); | |
$('.tabs-content').eq(index).show(); | |
return false; | |
}); | |
}); |
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
mixin tabs(tabs) | |
-for tab in tabs | |
li: a(href="javascript:")=tab | |
+tabs(["First", "Second", "Third"]) | |
.tabs-content | |
First | |
.tabs-content | |
Second | |
.tabs-content | |
Third |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment