Skip to content

Instantly share code, notes, and snippets.

@danielt69
Last active February 15, 2017 07:56
Show Gist options
  • Select an option

  • Save danielt69/be705dced82e8ec4d86158d30c6b25b9 to your computer and use it in GitHub Desktop.

Select an option

Save danielt69/be705dced82e8ec4d86158d30c6b25b9 to your computer and use it in GitHub Desktop.
simple tabs js
var rounds = $('.section.euro_main_table .rounds .round');
// tabs
$('.section.euro_main_table .tabs .tab').each(function(index, value) {
$(this).on('click.tab', function() {
// console.log(index);
$(this).addClass('active').siblings().removeClass('active');
rounds[index] && rounds.removeClass('active').eq(index).addClass('active');
});
});
// v2
var simpleTabs = function(aaa,bbb) { // aaa = tabs, bbb = section that links to tab
aaa.each(function(index, value) {
$(this).on('click.tab', function(e) {
e.stopPropagation();
e.preventDefault();
$(this).addClass('active').siblings().removeClass('active');
bbb[index] && bbb.removeClass('active').eq(index).addClass('active');
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment