From: xangelo Date: Tue, 6 Jun 2023 19:22:57 +0000 (-0400) Subject: fix: switching between tabs doesnt always work X-Git-Tag: v0.0.1~57 X-Git-Url: https://git.xangelo.ca/?a=commitdiff_plain;h=375c2fd07578829bcb1a71fcbc7b8b9da90ff68a;p=risinglegends.git fix: switching between tabs doesnt always work --- diff --git a/public/assets/css/game.css b/public/assets/css/game.css index eb79b1b..6d8387f 100644 --- a/public/assets/css/game.css +++ b/public/assets/css/game.css @@ -178,6 +178,9 @@ nav a.active { .tab { display: none; } +.tab.active { + display: block; +} #main-nav { margin-bottom: 2rem; } diff --git a/src/client/index.ts b/src/client/index.ts index 63613e8..d5caf51 100644 --- a/src/client/index.ts +++ b/src/client/index.ts @@ -184,10 +184,11 @@ $('nav a').on('click', e => { e.preventDefault(); e.stopPropagation(); - const tabContainer = $(e.target).data('container'); + const $tabContainer = $(`#${$(e.target).data('container')}`); - $(`#${tabContainer} .tab`).css('display', 'none'); - $(`#${$(e.target).data('section')}`).css('display', 'block'); + $tabContainer.find('.tab').removeClass('active'); + + $(`#${$(e.target).data('section')}`).addClass('active'); $(e.target).closest('nav').find('a').removeClass('active'); $(e.target).addClass('active');