$.exists = function(selector) { return ($(selector).length > 0); } $(function(){ /* 서브 모바일 메뉴 스타일 02에만 적용 */ if( $.exists("#sub_m_menu_style_02") ) { var dep1MobileMenu = $(".sub-visual-txt-con").find('h2').text(); $(".location1").find(".cur-location").find("span").text(dep1MobileMenu) } // SUB MOBILE MENU $(".sub-top-menu-m").find(".dropdown-menu").click(function(){ var $subMenuList = $(this).find(".dropdown-list"); if( $.exists("#sub_m_menu_style_02") ) { $(".sub-top-menu-m").find(".dropdown-menu").removeClass("open") } if ($subMenuList.css("display") == "block"){ $subMenuList.stop().slideUp(); $(this).removeClass("open") }else{ $subMenuList.stop().slideDown(); $(this).addClass("open") } }) // PC :: 스타일 1,2와 3의 경우의 js 분리 if( $.exists("#sub_menu_style_03") ){ var dep1CurrentMenu = $(".sub-top-menu .location1 > button > span").text(); var dep1ListMenu = $(".sub-top-menu .location1 .snb"); var currentUrlBefore = window.location.href; var currentUrl = $(currentUrlBefore.split('?')); /* 1차 메뉴 */ $(dep1ListMenu).find("li").each(function(){ var indexMenu = $(this).find("a").text(); if ( dep1CurrentMenu == indexMenu) { $(this).addClass("on") } }) /* 2차 메뉴 */ $(".sub-top-menu").find(".location2").find("li").each(function(){ var urlSplitBefore = $(this).find("a").prop("href"); var urlSplit = $(urlSplitBefore.split('?')); if ( urlSplit[0] == currentUrl[0] ) { $(this).addClass("on") } }) } else{ var currentUrlBefore = window.location.href; var currentUrl = $(currentUrlBefore.split('?')); $(".sub-top-menu").find("li").each(function(){ var urlSplitBefore = $(this).find("a").prop("href"); var urlSplit = $(urlSplitBefore.split('?')); if ( urlSplit[0] == currentUrl[0] ) { $(this).addClass("on") } }) } // 게시판 버튼 if($(".bbs-search-box").hasClass("iconUse")){ $(".est_btn_cell input").attr("src", "") var searchIcon= $(".cm_icon_search").prop("value") $(".est_btn_cell input").attr("value", searchIcon) $(".est_btn_cell input").attr("type","submit") } /************************************** 폼메일 전용 JS ***************************************/ // 일반 폼메일 02 if ($.exists("#cm_formmail_style_02")) { $(".form-wrap tr").attr('height' , 'auto') $("#cm_formmail_style_02").find('.formmail').children('tbody').children('tr').each(function(){ if( $(this).find('input[type=file').length) { $(this).addClass("file") } }) } // 예식 폼메일 전용 if ($.exists("#cm_formmail_style_03")) { $("#cm_formmail_style_03 .form-content .form-wrap .formmail > tbody").find("tr").each(function(){ if( $(this).find("textarea").length) { $(this).addClass("textarea") } }) } /************************************** 탭 메뉴 공통 사용 ***************************************/ if( $.exists("#cm_tab_container") ) { $("#cm_tab_container").find('a').click(function(ignore) { ignore.preventDefault(); }); var $cmTabList = $("#cm_tab_container"); var $cmTabListItem = $cmTabList.find("li"); var $cmConWrapper = $("#cm_tab_content_wrapper") var $cmContent = $cmConWrapper.children() $cmTabListItem.click(function(){ if( !$(this).hasClass("selected")) { var visibleCon = $(this).find('a').attr('href'); $cmTabListItem.removeClass("selected") $(this).addClass("selected"); $cmContent.hide(); $(visibleCon).fadeIn(); } return fasle; }) } /************************************** 테이블 스크롤 플러그인 ***************************************/ $(".custom-scrollbar-wrapper").each(function () { if ( $("html").attr("lang") == "ko" ) { var dragTxt = "좌우로 드래그 해주세요."; console.log('ko') }else { var dragTxt = "Drag left and right."; } $(this).append("

"+dragTxt+"

"); var $scrollObject = $(this).find(".scroll-object-box"); if ($.exists($scrollObject)) { customScrollX($scrollObject); } $(this).on("touchmove click",function () { $(this).find(".custom-scrollbar-cover").fadeOut(200); }); }); /************************************** 모달 팝업 플러그인 ***************************************/ if ($.exists(".popup-gallery")) { magnificPopup($(".popup-gallery")); } }) // 테이블 스크롤 모드 function customScrollX (scrollObject) { $(scrollObject).mCustomScrollbar({ axis:"x", theme:"dark" }); } function customScrollY (scrollObject) { $(scrollObject).mCustomScrollbar({ axis:"y", theme:"dark" }); } // 모달 팝업 플러그인 function magnificPopup (popupGallery) { $(popupGallery).magnificPopup({ delegate: 'a', type: 'image', closeOnContentClick: true, closeBtnInside: true, fixedContentPos: true, mainClass: 'mfp-with-zoom', removalDelay: 500, //delay removal by X to allow out-animation callbacks: { beforeOpen: function() { // just a hack that adds mfp-anim class to markup this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim'); this.st.mainClass = this.st.el.attr('data-effect'); } }, closeOnContentClick: true, midClick: true, // allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source. }); }