Created
May 9, 2020 23:38
-
-
Save johnpdang/bfbdefc176675990f6d7c31cfa4634a5 to your computer and use it in GitHub Desktop.
Tabs
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
| const tabs = () => { | |
| $(".nav-tabs a").click(function () { | |
| $('.nav-tabs a').removeClass('active'); | |
| $(this).tab('show').blur().addClass('active'); | |
| const link_text = $(this).html(); | |
| const tab_trigger = $(this).closest('.tabs-dropdown-wrap').prev('.tab-dropdown-trigger'); | |
| tab_trigger.html(link_text); | |
| if($(window).innerWidth() < 991){ | |
| $(this).closest('.tabs-dropdown-wrap').slideUp(); | |
| tab_trigger.removeClass('active'); | |
| } | |
| }); | |
| $('.tab-dropdown-trigger').click(function(e){ | |
| e.preventDefault(); | |
| $(this).blur().toggleClass('active'); | |
| $(this).next('.tabs-dropdown-wrap').slideToggle(); | |
| }); | |
| } | |
| export default tabs; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment