|
|
|
@ -40,16 +40,19 @@ $(function() { |
|
|
|
if (!tabId) return; |
|
|
|
const $dropdownItem = $(`.d-tabs__dropdown-item[data-tab="${tabId}"]`).first(); |
|
|
|
if ($dropdownItem.length) { |
|
|
|
$dropdownItem.addClass("is-active").siblings().removeClass("is-active"); |
|
|
|
$(".d-tabs__dropdown-item").removeClass("is-active"); |
|
|
|
$dropdownItem.addClass("is-active"); |
|
|
|
const $trigger = $dropdownItem.closest(".d-tabs__group").find("[data-dropdown-trigger]"); |
|
|
|
$trigger.find("span").text($dropdownItem.text()); |
|
|
|
activateTab($trigger); |
|
|
|
return; |
|
|
|
} |
|
|
|
$(".d-tabs__dropdown-item").removeClass("is-active"); |
|
|
|
const $target = $(`.d-tabs__item[data-tab="${tabId}"]`).first(); |
|
|
|
if ($target.length) activateTab($target); |
|
|
|
}; |
|
|
|
$(".d-tabs__item:not([data-dropdown-trigger])").on("click", function() { |
|
|
|
$(".d-tabs__dropdown-item").removeClass("is-active"); |
|
|
|
activateTab($(this)); |
|
|
|
closeDropdowns(); |
|
|
|
}); |
|
|
|
@ -65,7 +68,8 @@ $(function() { |
|
|
|
}); |
|
|
|
$(".d-tabs__dropdown-item").on("click", function() { |
|
|
|
const $item = $(this); |
|
|
|
$item.addClass("is-active").siblings().removeClass("is-active"); |
|
|
|
$(".d-tabs__dropdown-item").removeClass("is-active"); |
|
|
|
$item.addClass("is-active"); |
|
|
|
const $trigger = $item.closest(".d-tabs__group").find("[data-dropdown-trigger]"); |
|
|
|
$trigger.find("span").text($item.text()); |
|
|
|
activateTab($trigger); |
|
|
|
|