parent
56f505741f
commit
5676c1462a
@ -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