mjon_git/src/main/webapp/publish/js/popup.js
2023-06-12 11:15:02 +09:00

89 lines
2.4 KiB
JavaScript

$(document).ready(function () {
/* 포토에디터 스크롤바 꾸미기 */
if($(".contWrap_scroll").length>0){
$(".contWrap_scroll").mCustomScrollbar({
axis: 'y',
scrollbarPosition: "outside",
theme: "dark",
autoHideScrollbar: false,
scrollInertia: 600,
callbacks: {
//스크롤이 생길 때
onOverflowY: function () {
$(".contWrap").addClass("on_scroll");
},
//스크롤이 없어질 때
onOverflowYNone: function () {
$(".contWrap").removeClass("on_scroll");
},
onTotalScroll:function(){
console.log("Scrolled to end of content.");
var pageNo = $('#pageIndex').val();
if(pageNo && !isNaN(pageNo)) { // TODO: 총페이지 체크
linkPhoPage(++pageNo);
}
}
}
});
}
/* 포토에디터 이미지 미리보기 drag */
//div 순서에 따라 숫자 지정
$('.image_preview .drag_img').each(function (i) {
var dragNum = i + 1;
$(this).find(".img_number span").text(dragNum);
});
//드래그 및 드래그 시 숫자 변경
if($(".image_preview").length>0){
$(".image_preview").sortable({
update: function (event, ui) {
$('.image_preview .drag_img').each(function (i) {
var numbering = i + 1;
$(this).find(".img_number span").text(numbering);
});
}
});
}
});
// 포토에디터 헤더 tab
function TabType3(obj, tabId) {
var $tab = $(obj).closest("li");
$tab.addClass("active");
$tab.find("button").attr("title", "선택됨");
$tab.siblings("li.tab").removeClass("active");
$tab.siblings("li.tab").find("button").removeAttr("title");
var $tabCn = $("#tab3_" + tabId);
$tabCn.fadeIn(0);
$tabCn.addClass("current");
$(".header_cont").not($tabCn).removeClass("current");
$(".header_cont").not($tabCn).fadeOut(0);
currTabId = tabId;
}
/* 이미지불러오기 클릭 시 photo editer 새창 팝업 오픈 */
function showPotoediter() {
//만들려는 팝업의 크기
var popup_wid = '950';
var popup_ht = '761';
//중앙 정렬을 위해 윈도우 스크린의 width,height 구하는 변수 만듦
var popup_left = (window.screen.width / 2) - (popup_wid / 2);
var popup_top =(window.screen.height / 2) - (popup_ht / 2);
window.open('photo_editer.html', 'a', 'width='+ popup_wid +', height='+ popup_ht +', left=' + popup_left + ', top='+ popup_top );
}