Created
November 12, 2017 23:37
-
-
Save shohagbhuiyan/83994d90674c7970471dfa06a92f52f1 to your computer and use it in GitHub Desktop.
jQuery Tabs using CSS
This file contains hidden or 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