function openMenuPop(url, width, height) { var result = "false"; inWidth = width; inHeight = height; x = screen.availWidth; y = screen.availHeight; xtop = Number((y - inHeight)/2); xleft = Number((x - inWidth)/2); //loginAuthId /* * 회원회비 로그?체크 * 로그?안한 상태에서 * 자사정보 변?& 회비납부현황 조회 클릭?로그인창 띄우? */ /* if( (url.indexOf('//comp.flamingonakliyat.com/memberInfo/selectMemberView.do') >= 0 || url.indexOf('//comp.flamingonakliyat.com/memberInfo/selectMemberView06.do') >= 0) && loginAuthId == '' ){ fn_goPage('login'); return; }*/ //window.open(url, "search","top="+xtop+",left="+xleft+",width="+inWidth+",height="+inHeight+",SCROLLBARS=" + scroll); window.open(url, "", "top="+xtop+",left="+xleft+",width="+inWidth+",height="+inHeight); } function bodyOpen(t){ $('body').addClass('open-'+t); console.log('open',t) ; if (t=='gnb'){ $('[data-close="ai-search"]').trigger('click') ; $('.bt-open-gnb').addClass('active') ; } else{ bodyClose('gnb'); } $('body, .hd').css('padding-right' , getScrollBarWidth ()) ; } function bodyClose(t){ console.log('close',t) ; if (t=='gnb'){ $('.gnb-nav, .bt-open-gnb , .gnb-depth1 a.active').removeClass('active') ; } $('body').removeClass('open-'+t); $('body, .hd').css('padding-right' , 0) ; } $(function(){ // gnb open menu $('[data-gnb]').off().on('click',function(e){ e.preventDefault() , e.stopPropagation() ; var dataGnb = $(this).data('gnb'), dataTg = $(this).data('target'), parentMo = $(this).parents('.gnb-mo'); if ( $(this).hasClass('active')) { if ( !parentMo.length ) { bodyClose('gnb'); } } else { bodyOpen('gnb'); $('.gnb-nav').addClass('active'); if (dataGnb == 'menu') { $('[data-gnb]').removeClass('active'); $(dataTg).addClass('active').siblings().removeClass('active') ; } if (dataGnb == 'mo') { // 모바?현재메뉴 디폴?열리? var openDiv = $('.gnb-mo .mo-menu').find('.open') ; openDiv.find('ul').show() ; openDiv.siblings('div').find('ul').hide() ; if ( !$('.gnb-depth1').find('a.active').length ) { var depIdx = $('.mo-depth1').find('a.active').data('target') ; $('.gnb-depth1 a[data-target="'+depIdx+'"]').click() ; } } $('[data-target="'+dataTg+'"], .bt-open-gnb').addClass('active') ; } }); $('.gnb-dim').on('click',function(e){ bodyClose('gnb'); }); // gnb mobile toggleSlide $('.gnb-mo .menu-sect .st a').on('click',function(e){ var $parentDiv = $(this).parent('.st').parent('div') ; var ulLen = $parentDiv.find('ul').length ; if ( ulLen ){ e.preventDefault() ; e.stopPropagation() ; $parentDiv.find('ul').slideToggle().toggleClass('active') ; $parentDiv.siblings('div').find('ul').slideUp().removeClass('active') ; ; } }); //lnb $('.local-lnb .local-depth').off().on('click', function(e){ e.preventDefault(), e.stopPropagation(); if($(this).next('.local-depth-menu').css('display') == 'block'){ $(this).removeClass('on'); $(this).next('.local-depth-menu').hide(); } else { $(this).addClass('on'); $(this).next('.local-depth-menu').show(); } }); $(document).on('click', function(e){ if(e.target != '.local-lnb .local-depth') { $('.local-lnb .local-depth').removeClass('on'); $('.local-depth-menu').hide(); } }); $('.local-depth-menu .btn-close').off().on('click', function(){ $(this).parents('.local-depth-menu').hide(); $(this).parents('.local-depth-menu').siblings('.local-depth').removeClass('active'); }); $(document).on('click','[data-open]',function(e){ e.preventDefault() , e.stopPropagation() ; var dataType = $(this).data('open') , dataTg = $(this).data('target'); switch (dataType) { case 'modal': var dataBackdrop = $(this).data('backdrop') ; modal.open(dataTg, dataBackdrop) ; break; default: bodyOpen(dataType); $(dataTg).addClass('active') break; } }); $(document).on('click','[data-close]',function(e){ e.preventDefault() , e.stopPropagation() ; var dataType = $(this).data('close'), dataTg = $(this).data('target'); switch (dataType) { case 'modal': dataTg = $(this).parents('.modal'); modal.close(dataTg); dataTg.find('.video-wrap').empty(); break; default: bodyClose(dataType); $(dataTg).removeClass('active') break; } }); // board accordian //data-share $('button[data-share]').on('click',function(){ $(this).toggleClass('active'); }); //data-toggle $('[data-toggle]').off().on('click',function(){ var tg = $(this).data('target') , dVal = $(this).data('toggle') ; if ( $(tg).parents('.side-menu').length > 0 ){ $(tg).siblings('.active').removeClass('active') ; } $(tg).toggleClass(dVal); }); //datepicker datepickerLoad(); $(document).on('click','.datepicker .delete-date',function(){ $(this).parent('.datepicker').find('input').val('').removeClass('selected') ; }); // mo ver - top title var hdTitle ; if ($('.sect-top').length > 0 ){ hdTitle = $('.sect-top h3').text() ; } else { hdTitle = $('.sub-top .top-content .h1').eq(0).text() ; } if ($('.local-lnb').length > 0 && ! hdTitle ){ console.log(hdTitle ) ; hdTitle = $('.local-home a').text() ; } $('header.hd .depth-title').text( hdTitle ); // mobile nav-category var navCategoryWrap = $('.nav-category-wrap'); if(navCategoryWrap.length){ for (var i = 0; i < navCategoryWrap.length; i++) { var navCate = navCategoryWrap.find('.nav-category').eq(i); var thisActive = navCate.find('.nav-link.active').offset().left + navCate.find('.nav-link.active').width() ; if ( thisActive > $(window).width() ){ navCate.animate({scrollLeft :thisActive }, 500); } } } // 상세검? // 상세검?클릭? $('.search-group [data-expand]').click(function(){ var t = $(this) ; if (t.hasClass('on')) { t.removeClass('on'); t.parents('.search-group').removeClass('expanded') ; $('#expandSeachYn').val('N'); } else { t.addClass('on'); t.parents('.search-group').addClass('expanded') ; $('#expandSeachYn').val('Y'); } }); // 날짜기간 클릭? $('[data-date-range]').click(function(e){ var parentWrap = $(this).parents('.form-row') , datepicker = parentWrap.find('.datepicker') ; var lastDate = dateset() ; var dateRange = $(this).data('date-range'), setRange = dateRange.split(',') ; var firstDate = dateset(firstDate , setRange[0] , setRange[1]) ; $(this).parents('ul').find('[data-date-range]').removeClass('active') ; $(this).addClass('active'); parentWrap.find('.first-date').val(firstDate); parentWrap.find('.last-date').val(lastDate); }); // 전체선택 클릭? $('.choice-group input[type=checkbox]').click(function(){ var t = $(this), chkGroup = t.parents('.choice-group') , chkAll = chkGroup.find('input[data-type="all"]') ; if( t.data('type') == "all" ) { chkGroup.find('input[type=checkbox]').prop('checked',false) ; chkAll.prop('checked',true) ; } else { chkAll.prop('checked',false) ; } }); //mo tab 가로스크롤 위치 if ( isMobile() && $('.nav-x-wrap').length > 0 ){ var sLeft = $('.nav-x-wrap').find('.nav-link.active').parent('.nav-item').offset().left - 15 ; // console.log(sLeft) ; $('.nav-x-wrap').scrollLeft(sLeft) ; } // text 더보? if ($('.text-moreview').length > 0 ){ // 높이?초과 일때?버튼 노출 textmoreview() ; $(window).on('load resize', function(){ textmoreview(); }); $('.text-moreview .btn-moreview').click(function(){ if($('.navi-wrap')[0]) { $(this).parents('.text-moreview').toggleClass('active'); } else { if(!isMobile()){ $(this).parents('.text-moreview').toggleClass('active'); } } }); } function textmoreview(){ var tWrapper = $('.text-moreview') ; tWrapper.each(function(){ console.log($(this)) ; var tWrap = $(this).find('.text-wrap') ; if ( $(this).height() < tWrap.height() ){ tWrap.addClass('ellipsis') ; } }); } // 확장?배너 스와이퍼 // ======================= banner-swiper var sideSwiper = new Array ; $(".swiper-banner-extend .swiper-container").each(function(e){ var $tgParent = $(this).parent() ; var btNext = $tgParent.find('.bt-next') ; var btPrev = $tgParent.find('.bt-prev') ; var paginationEl = $tgParent.find('.swiper-pagination') ; sideSwiper[e] = new Swiper(this, { slidesPerView:1, spaceBetween: 0 , loop : true , observer: true, observeParents: true, watchOverflow : true, autoplay: { delay: 3000, disableOnInteraction:false, pauseOnMouseEnter:false }, navigation: { nextEl: btNext, prevEl: btPrev, }, pagination: { el: paginationEl , type:"fraction" }, }) ; }); $('.swiper-banner-extend .bt-play').each(function(e){ $(this).on('click',function(){ var $t = $(this) ; $t.toggleClass('autoplay'); setTimeout(() => { if( $t.hasClass("autoplay")){ sideSwiper[e].autoplay.stop(); }else{ sideSwiper[e].autoplay.start(); } }, 50); return false; }); }); // test $('select').on('change' , function(e){ $(this).trigger('blur') ; }) ; // 툴팁? close $('html').on('click',function(e){ var tg = $(e.target) ; // 헤더 사이드메?확장 부? if ( !tg.parents('.side-menu>div').length) { if( !tg.hasClass('aside-option') && $('.hd .side-menu>div.active').length > 0 ) $('.hd .side-menu>div.active').removeClass('active') ; } // 풋터 패밀리메? if ( !tg.parents('.familysite').length) { if( $('.familysite dl.on').length > 0 ) $('.familysite dl.on').removeClass('on') ; } }) ; }); function mcScroll(tg){ if ( !tg ) tg = 'body'; var $tg = $(tg) ; if ( !isMobile() ) { $tg.find('.msc').each(function(){ $(this).mCustomScrollbar({ theme:"dark", scrollInertia: 0 }); }); } } function isMobile(){ if ( $(window).width() < 1024 ) { return true ; } else { return false ; } } function datepickerLoad(){ var $lastInput ; //datepicker if ($( ".datepicker" ).length) { var dateToday = new Date(); $('.datepicker').each(function(){ var changeOpt = false; var $picker = null ; if ( $(this).hasClass('shown') ) { // shown => 날짜 테이?show 디폴? var $picker = $(this) ; } else { var $picker = $(this).find('input'); $(this).append('') ; }; var mindateVal = $picker.data('min') ? $picker.data('min') : null ; var maxdateVal = $picker.data('max') ? $picker.data('max') : null ; var multiMonth = ( Math.floor($(this).data('multi')) > 1 ) ? $(this).data('multi') : 1 ; if($picker.data('select-year')){ changeOpt = true; } $(this).on('click',function(e){ // console.log( $lastInput , $picker ) // 인풋박스가 아니? if ( $(e.target).has('input').length ){ //위젯?열려있고 open == now 인지 확인 if ( $picker.datepicker( "widget" ).is(":visible") && $lastInput == $picker ) { $picker.datepicker( "hide" ); //닫자 $lastInput = $picker ; return false; } } $lastInput = $picker ; }); $picker.datepicker({ // showAnim: '' , // duration: 'fast' , dateFormat: "yy.mm.dd", monthNames : [ "1?, "2?, "3?, "4?, "5?, "6?, "7?, "8?, "9?, "10?, "11?, "12? ], monthNamesShort: [ "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" ], dayNamesMin:[ "?, "?, "?, "?, "?, "?, "? ], minDate: mindateVal, maxDate: maxdateVal, numberOfMonths: multiMonth , // dateFormat : 'MM yy' , altField: ".datepicker", changeMonth: changeOpt, changeYear: changeOpt, onSelect: function ( dateText, inst ) { if (dateText && $(this).data('can-clear')){ $(this).addClass('selected') ; } var pairType = $(this).data('pair-type'); if(pairType){ global.pairPickerValidate(this); } // picker가 input-text 형식?? if( $(this).attr('type') == 'text') { $(this).change(); } }, beforeShow: function ( dateText, inst ) { // modal ?경우 z-index 높임 if ( $(this).parents('.modal').length > 0 ) { $(this).css('z-index',1999) ; } if ( $(this).parent().hasClass('button-picker') ) { setTimeout(function () { inst.dpDiv.css({ left:'50%', 'transform' : 'translateX(-50%)' , }); }, 10); } } }) if ($picker.val() && $picker.data('can-clear')){ $picker.addClass('selected') ; } }); } if ($( ".yearpicker-label" ).length) { $('.yearpicker').each(function(){ var thisVal = $(this).val() ? Number($(this).val()) : null ; $(this).yearpicker({ year : thisVal , onShow: function(value){ } }); }); $('.yearpicker-label').on('click',function(e){ var $thisTg = $(e.target) ; // yearpicker가 아니? if ( $thisTg.has('.yearpicker').length ){ var $yContainer = $thisTg.find('.yearpicker-container') , $yPicker = $thisTg.find('.yearpicker'); //위젯?열려있는지 확인 if ( $yContainer.hasClass('hide') ) { $yPicker.trigger('focus') ; return false; } else { $('.ct').trigger('click'); return false; } } }); } } function dateset( datevalue , addvalue , num) { var dateVal = (datevalue) ? new Date(datevalue) : new Date() ; if (addvalue) { switch (addvalue) { case 'day': dateVal = new Date(dateVal.setDate(dateVal.getDate() + (num * 1))); break; case 'month': dateVal = new Date(dateVal.setMonth(dateVal.getMonth() + (num * 1))); break; } } var year = dateVal.getFullYear(), month = ('0' + (dateVal.getMonth() + 1)).slice(-2), day = ('0' + dateVal.getDate()).slice(-2), dateString = year + '.' + month + '.' + day; return dateString; } // modal var modal = { open:function(e,bkd){ if ( bkd == null) var bkd = true; var backdropClose = ""; $(e).addClass('show').fadeIn(50, function(){ if (bkd) backdropClose = ' onclick="global.closeLayerPopup();"' ; $(this).removeClass('backto').siblings('.modal').addClass('backto'); $(this).append('

') ; if (bkd && !$(this).hasClass('modal-alert')) { $(this).find('p.backdrop-dim').attr('data-close','modal') ; } bodyOpen('modal'); mcScroll('.modal'); }) ; }, close:function(e){ $(e).removeClass('show').fadeOut(50, function(){ $(this).find('p.backdrop-dim').remove() ; var prevLen = $(this).prevAll('div').length; console.log($(this) , $(this).prevAll()) ; var openLen = $('body').find('.modal.show').length ; if (openLen > 0) { var backtoLen = $('body').find('.show.backto').length ; $('body').find('.show.backto').eq(backtoLen-1).removeClass('backto'); } else { bodyClose('modal'); } }) ; }, } // loading var loading = { open:function(loadingClass){ if(loadingClass){ $('.' + loadingClass).addClass('open') ; } else { $('.loading-wrap').addClass('open') ; } }, close:function(loadingClass){ if(loadingClass){ $('.' + loadingClass).removeClass('open') ; } else { $('.loading-wrap').removeClass('open') ; } }, } var subTopH = $('.sub-top').height() ; // 스크?이벤?$(window).on('scroll', function(){ if($(this).scrollTop()>1){ if ( !bodyScroll() ){ $('body').addClass('is-scroll'); } }else{ if ( bodyScroll() ){ $('body').removeClass('is-scroll'); } } if ( !isMobile() && $('.sub-top:not(.bg-theme-mypage)').length ){ subTopSc() // 서브?스크?액션 } }).trigger('scroll'); // 리사이즈 이벤?var mosiz = isGnbMobile() ; $(window).on('resize', function(){ clearTimeout(window.resizedFinished); window.resizedFinished = setTimeout(function(){ // mo -> pc 모바?메뉴 닫기 console.log('mo -> 1280') ; if ( mosiz == !isGnbMobile() && !isGnbMobile() ) bodyClose('gnb'); // pc -> mo - 사이트맵 닫기 (필수) console.log('1280 -> mo') ; if ( mosiz == !isGnbMobile() && isGnbMobile() ) { bodyClose('sitemap-all'); } mosiz = isGnbMobile() ; // subtop if ( !isMobile() && $('.sub-top:not(.bg-theme-mypage)').length ){ subTopSc('re'); } }, 50); if (isMobile()) { mobilevh(); $('.sub-top').attr('style','') ; } else { } }); function subTopSc(a){ if ( a == 're' ) { $('.sub-top').attr('style','').removeClass('scrolling') ; subTopH = $('.sub-top').height() ; $('.sub-top').height( subTopH ) ; } subTopH = $('.sub-top').height() ; var headerH = $('.hd').height() ; if (subTopH - $(window).scrollTop() < 85 ) { if ( $(window).width() > 1280 ) { $('.sub-top').addClass('scrolling').css('top' , - (subTopH - (headerH + 84)) ) ; } else { $('.sub-top').addClass('scrolling').css('top' , - (subTopH - 84) ) ; } } else { $('.sub-top').removeClass('scrolling').css('top', '0') ; } } function isGnbMobile(){ if ( $(window).width() < 1280 ) { return true ; } else { return false ; } } function bodyScroll(){ if ($('body').hasClass('is-scroll') ) { return true ; } else { return false ; } } // onload 이벤?$(window).on('load', function(){ mcScroll(); isMobile() ; if (isMobile()){ mobilevh(); } else { if ( $('.sub-top.sub-top:not(.bg-theme-mypage)').length ){ subTopSc('re'); } } }) function mobilevh(){ var vh = window.innerHeight * 0.01; document.documentElement.style.setProperty('--vh', `${vh}px`); } function getScrollBarWidth () { var inner = document.createElement('p'); inner.style.width = "100%"; inner.style.height = "200px"; var outer = document.createElement('div'); outer.style.position = "absolute"; outer.style.top = "0px"; outer.style.left = "0px"; outer.style.visibility = "hidden"; outer.style.width = "200px"; outer.style.height = "150px"; outer.style.overflow = "hidden"; outer.appendChild (inner); document.body.appendChild (outer); var w1 = inner.offsetWidth; outer.style.overflow = 'scroll'; var w2 = inner.offsetWidth; if (w1 == w2) w2 = outer.clientWidth; document.body.removeChild (outer); return (w1 - w2); };