Last active
February 15, 2017 07:56
-
-
Save danielt69/be705dced82e8ec4d86158d30c6b25b9 to your computer and use it in GitHub Desktop.
simple tabs js
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
| 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