$(document).ready(function(){ //썸네일 var galleryThumbs = new Swiper('.gallery-thumbs', { direction: 'vertical', freeMode: true, watchSlidesVisibility: true, watchSlidesProgress: true, slidesPerView: 'auto', autoHeight: true, noSwiping: true, onlyExternal: true, spaceBetween: 10, observer: true, observeParents: true, scrollbar: { el: '.swiper-scrollbar', }, mousewheel: true, //loop: true, }); //슬라이드 var swiper = new Swiper('.main_slider', { //zoom: true, slidesPerView: 'auto', navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, pagination: { el: '.swiper-pagination', type: 'fraction', renderFraction: function (currentClass, totalClass) { return '' + ' / ' + ''; } }, thumbs: { swiper: galleryThumbs, }, lazyLoading : true, zoom: { maxRatio: 1.7, } }); //mobile 기기 구분 var mobileKeyWords = new Array('iPhone', 'iPod', 'BlackBerry', 'Android', 'Windows CE', 'Windows CE;', 'LG', 'MOT', 'SAMSUNG', 'SonyEricsson', 'Mobile', 'Symbian', 'Opera Mobi', 'Opera Mini', 'IEmobile'); for (var word in mobileKeyWords){ if (navigator.userAgent.match(mobileKeyWords[word]) != null){ $('.nav .dep1 > li[data-navi="3"]').addClass('dis_n'); $('.btn_zoom').addClass('on'); swiper.zoom.disable(); } } //url 복사 var clipboard = new ClipboardJS('.url_copy_btn'); clipboard.on( 'success', function(e){ alert('복사 성공, 원하는 곳에 붙여넣으세요.'); }); clipboard.on( 'error', function(e){ alert( '복사 실패' ); }); var menuOff = false; var zoomOn = false; var pgOn = false; //menu 활성화 $('.menu_all').on('click', function(e){ navShow(); if(menuOff){ $('.menu_all').removeClass('off'); menuOff = false; } }); //섬네일 클릭시 메뉴 비활성화 $('.sch_img li').on('click', function(e){ navShow(); }); //dep2 활성화 $('.dep1 > li').on('click', function(e){ $(this).siblings().removeClass('on'); $(this).addClass('on'); if($(this).data('navi') == 3){ navShow(); } }); //본문영역 클릭시 메뉴 비활성화 $('.con').on('click', function(e){ menuShow(); }); //arrow 클릭시 메뉴 비활성화 $('.swiper-button-next, .swiper-button-prev').on('click', function(e){ pgOn = true; $('.hd, .ft').addClass('off'); $('.menu_all, .btn_zoom').addClass('off'); if(zoomOn){ getCntSrc(); } }); //브라우저 벗어날 시 메뉴 활성화 $('.con').mouseleave(function(e){ /* if(zoomOn == false){ $('.hd, .ft').removeClass('off'); $('.menu_all, .btn_zoom').removeClass('off'); }*/ }); //pop zoom 영역 활성화 $('.btn_zoom').on('click', function(e){ getCntSrc(); //getCntPos(); if(zoomOn){ $('.hd, .ft').addClass('off'); $('.menu_all, .btn_zoom').addClass('off'); } }); //pop zoom 비활성화 $('.btn_close').on('click', function(e){ $('.zoomer_basic, .zoomer_custom').zoomer('destroy'); popBg.removeClass('on'); popArea.removeClass('on'); zoomOn = false; }); //zoomer resize $(window).on("resize", function(e){ $(".c_zoom").zoomer("resize"); }); function menuShow(){ menuOff = $('.hd, .ft').hasClass('off'); $('.hd, .ft').toggleClass('off'); $('.menu_all, .btn_zoom').toggleClass('off'); if(pgOn){ $('.hd, .ft').addClass('off'); $('.menu_all, .btn_zoom').addClass('off'); pgOn = false; } } function navShow(){ $('.menu_all').toggleClass('on'); $('.nav').toggleClass('on'); $('.btn_zoom').toggleClass('navi_on'); } var popBg = $('.pop_bg'); var popArea = $('.pop_area'); //이미지 경로 호출 function getCntSrc(){ var cntTmp = swiper.realIndex; var imgSrc = $(".con .swiper-slide:nth-child(" + (cntTmp + 1) + ") div").children("img").attr("src"); popBg.addClass('on'); popArea.addClass('on'); zoomOn = true; zoomAction(); $('.zoomer-image').attr('src', imgSrc); } //zoomer function zoomAction() { $(".zoomer_basic").zoomer(); $(".zoomer_custom").zoomer({ controls: { zoomIn: ".zoomer_custom_zoom_in", zoomOut: ".zoomer_custom_zoom_out", next: null, previous: null } }); } });