enhance removeActiveTab

pull/3069/head
REJack 2020-10-03 14:31:11 +02:00
parent fdaedac545
commit 98962aeab7
1 changed files with 7 additions and 1 deletions

View File

@ -146,11 +146,17 @@ class IFrame {
}
removeActiveTab() {
$(`${SELECTOR_TAB_NAVBAR_NAV_ITEM}.active`).parent().remove()
const $navItem = $(`${SELECTOR_TAB_NAVBAR_NAV_ITEM}.active`)
const $navItemParent = $navItem.parent()
const navItemIndex = $navItem.index()
$navItem.remove()
$('.tab-pane.active').remove()
if ($(SELECTOR_TAB_CONTENT).children().length == $(`${SELECTOR_TAB_EMPTY}, ${SELECTOR_TAB_LOADING}`).length) {
$(SELECTOR_TAB_EMPTY).show()
} else {
const prevNavItemIndex = navItemIndex - 1
this.switchTab($navItemParent.children().eq(prevNavItemIndex).find('a'))
}
}