Merge pull request #2020 from poanetwork/fix/#1995-2nd-click-to-selected-tab-causes-hiding-of-other-tabs
(fix) wrong tabs behaviorpull/2050/head
commit
f7c3e49abb
@ -1,21 +1,26 @@ |
|||||||
import $ from 'jquery' |
import $ from 'jquery' |
||||||
|
|
||||||
$(function () { |
$(function () { |
||||||
const activeTabCard = $('.card-tab.active') |
const tabCards = $('.js-card-tabs') |
||||||
|
const activeTabCard = tabCards.find('.active') |
||||||
|
const isMobileCardTabs = tabCards.children(':hidden').length |
||||||
|
const isOnlyChild = !activeTabCard.siblings().length |
||||||
|
|
||||||
if (!activeTabCard.siblings().length) { |
if (isOnlyChild) { |
||||||
activeTabCard.addClass('noCaret') |
activeTabCard.addClass('noCaret') |
||||||
} |
} |
||||||
|
|
||||||
activeTabCard.on('click', function (e) { |
activeTabCard.on('click', function (e) { |
||||||
e.preventDefault() |
e.preventDefault() |
||||||
|
|
||||||
const siblings = $(this).siblings() |
if (isMobileCardTabs) { |
||||||
|
const siblings = $(this).siblings() |
||||||
|
|
||||||
if (siblings.is(':hidden')) { |
if (siblings.is(':hidden')) { |
||||||
siblings.show() |
siblings.show() |
||||||
} else { |
} else { |
||||||
siblings.hide() |
siblings.hide() |
||||||
|
} |
||||||
} |
} |
||||||
}) |
}) |
||||||
}) |
}) |
||||||
|
Loading…
Reference in new issue