fix: 업무 팝업 탭 close fix

main
Jonguk. Lim 2 years ago
parent add52d0a1d
commit dcc5da0b31

@ -13,9 +13,9 @@
/*content: '';*/
background-image: url(/resources/images/btn/bu5_close.gif);
display: inline-block;
background-size: 10px 10px;
width: 10px;
height: 10px;
background-size: 15px 15px;
width: 15px;
height: 15px;
cursor: hand;
background-position: right;
background-repeat: no-repeat;
@ -83,13 +83,14 @@
<div class="modal-wrap">
</div>
<script defer src="${pageContext.request.contextPath}/resources/biz/common/js/contentTabs.js"></script>
<script defer src="${pageContext.request.contextPath}/resources/biz/common/js/jqueryTabs.js"></script>
<script defer type="text/javascript">
//document.domain = "xit.com";
$(document).ready(() => {
$('#ifrTabs').tabs({
activate: function (e, ui){
const selTab = $('#ifrTabs').tabs('option', 'active');
if(selTab !== 0){

@ -60,18 +60,38 @@ function closeTab(menuId, selTab) {
if(menuId === 'main' || menuId?.id === 'main') return;
const num_tabs = $('div#ifrTabs ul li.tab').length;
let activeTab = $("#ifrTabs").tabs('option', 'active');
// click한 tab
const selIdx = id2Index("div#ifrTabs","#tab-"+menuId);
if(num_tabs - 1 > activeTab){
$('#ifrTabs').tabs({active: activeTab + 1})
}else{
$('#ifrTabs').tabs({active: activeTab - 1})
// active tab
let activeIdx = $("#ifrTabs").tabs('option', 'active');
if(selIdx === activeIdx) {
if (num_tabs - 1 > activeIdx) {
$('#ifrTabs').tabs({active: activeIdx + 1})
} else {
$('#ifrTabs').tabs({active: activeIdx - 1})
}
}
iframeMap[menuId].remove();
delete iframeMap[menuId];
$("#tab-" + activeTab).remove();
$("#tab-" + activeIdx).remove();
$('#ifrTabs').find('#li-'+menuId).remove();
$('#ifrTabs').tabs("refresh");
}
function id2Index(tabsId, srcId) {
let index = -1;
const tbH = $(tabsId).find("li a");
if(tbH.length > 0) {
tbH.each((idx, liEl) => {
if (liEl.href.search(srcId) > 0) {
index = idx;
return false;
}
});
}
return index;
}
Loading…
Cancel
Save