jQuery Tabs using CSS
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
/*Note: add class "tabSet1" or "tabSet2" after ul.tabs and tab-content */ | |
function tab(x) { | |
var a = $('ul.tabs.' + x + ' ' + 'li'); | |
a.click(function () { | |
var tab_id = $(this).attr('data-tab'); | |
a.removeClass('active'); | |
$('.tab-content.' + x).removeClass('active'); | |
$(this).addClass('active'); | |
$("#" + tab_id).addClass('active'); | |
}); | |
} | |
tab('tabSet1'); | |
tab('tabSet2'); | |
/* Follow the link to see in pactice | |
https://jsfiddle.net/shohagbhuiyan/zfL4osw0/1/ | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment