Skip to content

Instantly share code, notes, and snippets.

@vlgutv22
Created January 31, 2018 18:27
Show Gist options
  • Save vlgutv22/b4218b25dacf6876ba2c54829f69da2b to your computer and use it in GitHub Desktop.
Save vlgutv22/b4218b25dacf6876ba2c54829f69da2b to your computer and use it in GitHub Desktop.
//js
{
function howItWorksTabs() {
let item = jQuery('.howItWorksTabs__item'),
first = jQuery('.howItWorksTabs__item').first().attr('data-tab');
if (item) {
addActive(first, item);
item.click(function() {
var index = jQuery(this).attr('data-tab');
item.removeClass('active');
addActive(index, item);
});
}
function addActive(index, item) {
item.each(function() {
if (jQuery(this).attr('data-tab') === index) {
jQuery(this).addClass('active');
}
});
}
}
window.howItWorksTabs = howItWorksTabs;
}
//js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment