fix: 업무 팝업 탭 close fix

main
Jonguk. Lim 2 years ago
parent add52d0a1d
commit dcc5da0b31

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

@ -60,18 +60,38 @@ function closeTab(menuId, selTab) {
if(menuId === 'main' || menuId?.id === 'main') return; if(menuId === 'main' || menuId?.id === 'main') return;
const num_tabs = $('div#ifrTabs ul li.tab').length; 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){ // active tab
$('#ifrTabs').tabs({active: activeTab + 1}) let activeIdx = $("#ifrTabs").tabs('option', 'active');
}else{
$('#ifrTabs').tabs({active: activeTab - 1}) if(selIdx === activeIdx) {
if (num_tabs - 1 > activeIdx) {
$('#ifrTabs').tabs({active: activeIdx + 1})
} else {
$('#ifrTabs').tabs({active: activeIdx - 1})
}
} }
iframeMap[menuId].remove(); iframeMap[menuId].remove();
delete iframeMap[menuId]; delete iframeMap[menuId];
$("#tab-" + activeTab).remove(); $("#tab-" + activeIdx).remove();
$('#ifrTabs').find('#li-'+menuId).remove(); $('#ifrTabs').find('#li-'+menuId).remove();
$('#ifrTabs').tabs("refresh"); $('#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