/* ---------- js ---------- */ $(document).ready(function() { "use strict"; $('.loader').fadeOut(); $('.page-loader').delay(350).fadeOut('slow'); var swiperFull = new Swiper('.main-slider .swiper-container', { loop: true, slidesPerView: 1, preventClicks: false, allowTouchMove: true, pagination: { el: '.swiper-pagination', clickable: true }, autoplay: { delay: 5000 }, keyboard: { enabled: true }, on: { resize: function() { swiperFull.update(); } } }); var galleryTop = new Swiper('.gallery-top', { slidesPerView: 1, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, loop: true, loopedSlides: 150, on: { resize: function() { galleryTop.update(); } } }); var galleryThumbs = new Swiper('.gallery-thumbs', { slidesPerView: 5, spaceBetween: 10, // centeredSlides: true, slideToClickedSlide: true, loop: true, loopedSlides: 150, breakpoints: { 640: { slidesPerView: 3 }, 768: { slidesPerView: 4 } }, on: { resize: function() { galleryThumbs.update(); } } }); galleryTop.controller.control = galleryThumbs; galleryThumbs.controller.control = galleryTop; }); $(document).ready(function() { $(window).scroll( function() { var bodyOffset = jQuery('body').offset(); var header = $('#header'); var header_h = header.find('.header-logo').outerHeight(); var scrollTop = $(window).scrollTop(); if ($(window).width() > 991) { if (jQuery(document).scrollTop() > bodyOffset.top) { header.addClass('sticky'); } else { header.removeClass('sticky'); } } else { header.removeClass('sticky'); } } ); var gnbNav = $('#header .header-navWrap nav'); var nav_h = gnbNav.outerHeight(); var gnbBtn = $('#header .nav-btn'); var gnbMenuBg = $('#header .gnbMenuBg'); function menuItem() { gnbNav.find('#gnb > li > a, .header-navWrap-quick .quick-map a').on('click', function(e) { e.preventDefault(); if ($(window).width() > 991) { $('html, body').stop().animate({ scrollTop: $(this.hash).offset().top - 170 }, 500); } else { $('html, body').stop().animate({ scrollTop: $(this.hash).offset().top - $('#header').outerHeight() }, 500); } }); gnbNav.find('#gnb > li.interior > a').on('click', function(e) { e.preventDefault(); if ($(window).width() < 767) { $('html, body').stop().animate({ scrollTop: $(this.hash).offset().top - 180 }, 500); } }); $('.quick-menu .quick-map > a, .header-navWrap .btn-home-pc a').on('click', function(e) { e.preventDefault(); if ($(window).width() > 991) { $('html, body').stop().animate({ scrollTop: $(this.hash).offset().top - 180 }, 500); } }); } /* 모바일 메뉴 열기 */ function showGnb() { gnbBtn.addClass('Nav-open'); gnbNav.stop().slideDown(500, 'easeOutQuint'); gnbMenuBg.stop().fadeIn(500); }; /* 모바일 메뉴 닫기 */ function hideGnb() { gnbBtn.removeClass('Nav-open'); gnbNav.stop().slideUp(500, 'easeOutQuint'); gnbMenuBg.stop().fadeOut(500); }; gnbBtn.click(function() { if (!$(this).hasClass('Nav-open')) { showGnb(); } else { hideGnb(); } }); gnbMenuBg.click(function() { hideGnb(); }); gnbNav.click(function() { if ($(window).width() < 992) { hideGnb(); } }); menuItem(); $(window).scroll(function() { var header_sticky = $('#header').attr('class'); var pos; header_sticky == 'sticky' ? pos = 250 : pos = 300; $(".quick-menu").stop().animate({ top: $(window).scrollTop() + pos + 'px' }, 500); }).scroll();; $(window).resize(function() { }); }); $(document).ready(function () { setCookie(); getCookie(); popupModals(); //쿠키 값 셋팅 및 설정 function setCookie(name, value, expiredays) { var today = new Date(); today.setDate(today.getDate() + expiredays); document.cookie = name + '=' + escape(value) + '; path=/; expires=' + today.toGMTString() + ';' } function getCookie(name) { var cName = name + "="; var x = 0; var i = 0; while (i <= document.cookie.length) { var y = (x + cName.length); if (document.cookie.substring(x, y) == cName) { if ((endOfCookie = document.cookie.indexOf(";", y)) == -1) endOfCookie = document.cookie.length; return unescape(document.cookie.substring(y, endOfCookie)); } x = document.cookie.indexOf(" ", x) + 1; if (x == 0) break; } return ""; } //모달창 function popupModals() { $("div[id^='wb-popup']").each(function () { var _this = this.id; $(function () { //쿠기 값 설정 function closePopupNotToday() { setCookie(_this, 'Y', 1); $("#" + _this).fadeOut(200); } $("#" + _this + " #pos_close_today").click(function () { closePopupNotToday(); }); if (getCookie(_this) != "Y") { $("#" + _this).fadeIn(200); } else { $("#" + _this).hide(); } $("#" + _this + " .close-modal").click(function () { $("#" + _this).fadeOut(200); }); }); }) } });