Skip to content

Instantly share code, notes, and snippets.

@shohagbhuiyan shohagbhuiyan/tab.js
Created Nov 12, 2017

Embed
What would you like to do?
jQuery Tabs using CSS
/*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
You can’t perform that action at this time.