$(document).ready(function(){ var $vis_slider = $('.vis-slider .slider'), $plan_slider = $('.plan-slider .slider'), $photo_slider = $('.photo-slider .slider'), $video_slider = $('.video-slider .slider'), $popup_slider = $('.popup-slider .slider'), $sns_slider = $('.sns-slider .slider'), $bnr_slider = $('.bnr-slider .slider'), $notice_slider = $('.notice .slider'), $news_slider = $('.news .slider'); //section1 slider $vis_slider.slick({ slidesToShow : 1, slidesToScroll : 1, fade : true, prevArrow : $('.vis-slider .prev'), nextArrow : $('.vis-slider .next'), zIndex: 3, accessibility : false }); $('.vis-dots a').on('mouseover', function(){ $('.vis-dots a').removeClass('top'); $(this).addClass('top'); }); $('.vis-dots').on('mouseleave', function(){ $('.vis-dots a').removeClass('top'); }); // $vis_slider.on('beforeChange', function(event, slick, currentSlide, nextSlide){ // $('.vis-dots a').removeClass('active').eq(nextSlide).addClass('active'); // }); //section2 $plan_slider.slick({ slidesToShow : 5, slidesToScroll : 1, prevArrow : $('.plan-slider .prev'), nextArrow : $('.plan-slider .next'), swipeToSlide : true, responsive: [ { breakpoint: 1201, settings: { slidesToShow: 4 } }, { breakpoint: 800, settings: { slidesToShow: 3 } }, { breakpoint: 768, settings: { slidesToShow: 2 } }, { breakpoint: 481, settings: { slidesToShow: 1 } } ] }); $('.plan-slider .slider a').on('mouseover', function(){ $('.plan-slider .slider a').removeClass('top'); $(this).addClass('top'); }); $('.plan-slider .slider').on('mouseleave', function(){ $('.plan-slider .slider a').removeClass('top'); }); $('.eco-slider .slider a').on('mouseover', function(){ $('.eco-slider .slider a').removeClass('top'); $(this).addClass('top'); }); $('.eco-slider .slider').on('mouseleave', function(){ $('.eco-slider .slider a').removeClass('top'); }); //section3 var $sec3_tabBtn = $('.sec3-tab a'), $sec3_content = $('.sec3-content'), $sec3_img_slider = $('.sec3-wrap .sec3-content .img'), $sec3_thum_slider = $('.sec3-thum .slider'); // var sec3AnimateIndex = 0, // sec3Animate = setInterval(function(){ // if( sec3AnimateIndex >= $sec3_tabBtn.length - 1 ){ // sec3AnimateIndex = 0; // }else{ // sec3AnimateIndex++; // } // // $sec3_tabBtn.eq( sec3AnimateIndex ).trigger('click'); // }, 5000); $sec3_content.each(function(){ var target = $(this); var imgSlider = target.find('.img').slick({ slidesToShow : 1, slidesToScroll : 1, arrows: false, fade: true, asNavFor: thumbNailSlider, swipe: false, swipeToSlide: false }); var thumbNailSlider = target.find('.sec3-thum .slider').slick({ slidesToShow : 5, slidesToScroll : 1, arrows : false, swipeToSlide : true, dots: false, asNavFor: imgSlider, focusOnSelect: true, responsive: [ { breakpoint: 1201, settings: { slidesToShow: 4 } }, { breakpoint: 769, settings: { slidesToShow: 3 } }, { breakpoint: 481, settings: { slidesToShow: 2 } } ] }); // 최초 setting if( thumbNailSlider.slick('getSlick').slideCount > 0 ){ target.find('.content .subject').text( thumbNailSlider.find('.slick-current').data().subject ); target.find('.content .txt').text( thumbNailSlider.find('.slick-current').data().txt ); target.find('.btn-wrap .btn-cont').attr('href', thumbNailSlider.find('.slick-current').data().link ); if( $sec3_thum_slider.find('.slick-current').data().video != '' ){ target.find('.btn-wrap .btn-video').attr('href', thumbNailSlider.find('.slick-current').data().video ); }else{ target.find('.btn-wrap .btn-video').hide(); } } var sliderArrow = $('.sec3-thum .arrow'); sliderArrow.on('click', function(){ var direction = $(this).hasClass('prev') ? 'slickPrev' : 'slickNext'; $(this).siblings('.slider').slick(direction); return false; }); thumbNailSlider.on('beforeChange', function(event, slick, currentSlide, nextSlide){ target.find('.content .subject').text( thumbNailSlider.find('.slick-slide[data-slick-index="' + nextSlide + '"]').data().subject ); target.find('.content .txt').text( thumbNailSlider.find('.slick-slide[data-slick-index="' + nextSlide + '"]').data().txt ); target.find('.btn-wrap .btn-cont').attr('href', thumbNailSlider.find('.slick-slide[data-slick-index="' + nextSlide + '"]').data().link ); if( $sec3_thum_slider.find('.slick-slide[data-slick-index="' + nextSlide + '"]').data().video != '' ){ target.find('.btn-wrap .btn-video').show(); target.find('.btn-wrap .btn-video').attr('href', thumbNailSlider.find('.slick-slide[data-slick-index="' + nextSlide + '"]').data().video ); }else{ target.find('.btn-wrap .btn-video').hide(); } }); thumbNailSlider.find('.slick-slide').on('click', function(){ var this_index = $(this).data().slickIndex; $sec3_img_slider.slick('slickGoTo', this_index); return false; }); }); $sec3_tabBtn.on('click', function(){ $sec3_tabBtn.removeClass('active'); $(this).addClass('active'); $sec3_content.removeClass('active'); $sec3_content.eq( $(this).index() ).addClass('active'); setTimeout(function(){ $sec3_img_slider.slick('setPosition'); $sec3_thum_slider.slick('setPosition'); }, 1); if( $sec3_tabBtn.hasClass('active') ){ $sec3_tabBtn.attr('title', '열기'); $(this).attr('title', '열림'); }else{ $(this).attr('title', '열기'); } return false; }); $('.sec3-thum .slider a').on('mouseover', function(){ $('.sec3-thum .slider a').removeClass('top'); $(this).addClass('top'); }); $sec3_thum_slider.on('mouseleave', function(){ $('.sec3-thum .slider a').removeClass('top'); }); $('.sec3-thum .slider a').on('click', function(){ $(this).closest('.slider').find('a').attr('title', '활성화 하기'); $(this).attr('title', '활성화'); }); //section5 slider $photo_slider.slick({ slidesToShow : 1, slidesToScroll : 1, prevArrow : $('.photo .prev'), nextArrow : $('.photo .next'), autoplay: true }); $video_slider.slick({ slidesToShow : 1, slidesToScroll : 1, prevArrow : $('.video .prev'), nextArrow : $('.video .next'), autoplay: true }); $popup_slider.slick({ slidesToShow : 1, slidesToScroll : 1, prevArrow : $('.popup .prev'), nextArrow : $('.popup .next'), autoplay: true }); var popup_length = $('.popup-slider .slick-slide:not(.slick-cloned)').length; $('.popup .page .max').text( popup_length ); $('.popup-slider').on('beforeChange', function(event, slick, currentSlide, nextSlide){ $('.popup .page .index').text( nextSlide + 1 ); }); //sns $sns_slider.slick({ slidesToShow : 4, slidesToScroll : 1, prevArrow : $('.sns-slider .prev'), nextArrow : $('.sns-slider .next'), swipeToSlide : true, responsive: [ { breakpoint: 641, settings: { slidesToShow: 2 } }, { breakpoint: 481, settings: { slidesToShow: 1 } } ] }); var $snsBtn = $('.sns-btn a'); $snsBtn.on('click', function(){ var this_class = $(this).attr('class').replace(/\ active/gi, ''); if( $(this).hasClass('active') ){ $(this).removeClass('active'); $sns_slider.slick('slickUnfilter'); $(this).attr('title', '활성화 하기'); }else{ $snsBtn.removeClass('active'); $(this).addClass('active'); $sns_slider.slick('slickUnfilter'); $sns_slider.slick('setPosition'); $sns_slider.slick('slickFilter', $('.' + this_class)); $snsBtn.attr('title', '활성화 하기'); $(this).attr('title', '활성화'); } return false; }); //banner slider $bnr_slider.slick({ slidesToShow : 1, slidesToScroll : 1, prevArrow : $('.banner .btn-wrap .prev'), nextArrow : $('.banner .btn-wrap .next'), autoplay: true }); var bnr_length = $('.bnr-slider').find('.slick-slide:not(.slick-cloned)').length; $('.banner .page .max').text( bnr_length ); $bnr_slider.on('beforeChange', function(event, slick, currentSlide, nextSlide){ $('.banner .page .index').text( nextSlide + 1 ); }); $notice_slider.slick({ slidesToShow : 1, slidesToScroll : 1, prevArrow : $('.notice .prev'), nextArrow : $('.notice .next'), verticalSwiping : true, vertical : true, autoplay : true, swipeToSlide : true }); $news_slider.slick({ slidesToShow : 1, slidesToScroll : 1, prevArrow : $('.news .prev'), nextArrow : $('.news .next'), verticalSwiping : true, vertical : true, autoplay : true, swipeToSlide : true }); //section4 slick var $section4Slick = $('.section4 .sec4-content'), $section4_btn = $('.sec4-tab a'), $section4_link = $('.sec4-tab .moreBtn'), $section4_arrow = $('.sec4-content .btn-wrap .arrow'); $('.section4 .sec4-content').each(function(){ /* var $prev_arrow = $(this).find('.prev'), $next_arrow = $(this).find('.next'); */ $(this).find('.slider').slick({ slidesToShow : 4, slidesToScroll : 1, //prevArrow : $prev_arrow, //nextArrow : $next_arrow, arrows : false, rows : 2, infinite : false, swipeToSlide : true, responsive: [ { breakpoint: 1025, settings: { slidesToShow: 3 } }, { breakpoint: 769, settings: { slidesToShow: 3 } }, { breakpoint: 641, settings: { slidesToShow: 2 } }, { breakpoint: 481, settings: { slidesToShow: 1 } } ] }); //slider scrollbar var sec4_total = $(this).find('.slider').slick('getSlick').slideCount, // 전체 갯수 row라서 8 sec4_present = $(this).find('.slider').slick('getSlick').options.slidesToShow; //현재 갯수 4 $(this).find('.slider-scrollbar .bar').css({ 'width' : sec4_present / sec4_total * 100 + '%' }); $(this).find('.slider').on('beforeChange', function(event, slick, currentSlide, nextSlide){ var sec4_left = (sec4_present + nextSlide) / sec4_total * 100; // 현재갯수 + 이동갯수 //이동된만큼 %구하기 $(this).siblings('.slider-scrollbar').find('.bar').css({ 'left' : sec4_left - (sec4_present / sec4_total * 100) + '%' }); }); }); $section4_arrow.on('click', function(){ var direction = $(this).hasClass('prev') ? 'slickPrev' : 'slickNext'; $(this).closest('.sec4-content').find('.slider').slick(direction); return false; }); $section4_btn.on('click', function(){ setTimeout(function(){ $section4Slick.find('.slider .slick-list').css({ 'width' : '100%' }); $section4Slick.find('.slider').slick('setPosition'); }, 5); $section4_btn.removeClass('active'); $(this).toggleClass('active'); $section4Slick.removeClass('active'); $section4Slick.eq( $(this).index() ).addClass('active'); $section4_link.attr('href', $(this).data().link); return false; }); /* var swiper = new Swiper(".sec4-swiper", { slidesPerView: 8, spaceBetween: 30, slidesPerGroup: 8, loopFillGroupWithBlank : true, grid: { rows: 2, }, //centeredSlides: false, //slidesPerGroupSkip: 1, //grabCursor: true, keyboard: { enabled: true, }, breakpoints: { 769: { slidesPerView: 2, slidesPerGroup: 2, }, }, scrollbar: { el: ".swiper-scrollbar", }, navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev", }, pagination: { el: ".swiper-pagination", clickable: true, type: 'progressbar', // And if we need scrollbar 진행바 }, }); */ //section5 var $sec5_stop = $('.sec5-top li:not(.calendar) .btn-wrap .stop, .banner .btn-wrap .stop'); $sec5_stop.on('click', function(){ if( $(this).hasClass('play') ){ $(this).removeClass('play'); $(this).closest('.title').siblings('.sec5-slider').find('.slider').slick('slickPlay'); $(this).attr('title', '정지하기'); $(this).text('정지하기'); }else{ $(this).addClass('play'); $(this).closest('.title').siblings('.sec5-slider').find('.slider').slick('slickPause'); $(this).attr('title', '재생하기'); $(this).text('재생하기'); } return false; }); // full page var wheelcount = 0, subcount = 0, subscroll = 0, $section = $('.section'), $footer = $('.footer'), section_length = !$('html').hasClass('eng') ? $section.length + $footer.length : $section.length, sec2_length = $('.sec2-content').length - 1, sectionArray = new Array, section2Array = new Array, scrolldelay, sectionUrl, isPC = $(window).width() > 1024; sectionUrl = window.location.href; sectionUrl = sectionUrl.replace(/\?section=([0-9])/gi, ''); sectionUrl = sectionUrl.replace(/\&InSection\=([0-9])/gi, ''); $section.each(function(i){ sectionArray[i] = $(this).position().top }); if( !$('html').hasClass('eng') && $('.footer') != undefined ){ sectionArray.push( $('.footer').offset().top ); } $(window).on('resize', function(){ isPC = $(window).width() > 1024; if( isPC == true ){ $section.each(function(i){ sectionArray[i] = $(this).position().top }); if( !$('html').hasClass('eng') ){ sectionArray.push( $('.footer').offset().top ); } } }); $(window).on('mousewheel DOMMouseScroll', function(e){ if( isPC == true && !$('body').hasClass('sitemap-open') ){ //console.log(1); clearTimeout(scrolldelay); scrolldelay = setTimeout(function(){ if( e.originalEvent.wheelDelta > 0 ){ //올림 if( wheelcount > 0 ){ /* if( wheelcount == 1 && subcount <= sec2_length && subcount > 0 ) { subcount--; subscroll -= 100; }else{ wheelcount--; } */ wheelcount--; } }else{ //내림 if( wheelcount < ( section_length - 1 ) ){ // section length보다 같거나 작을때 /* if( wheelcount == 1 && subcount < sec2_length ){ subcount++; subscroll += 100; }else{ wheelcount++; } */ wheelcount++; } } $('.sec2-tab a').removeClass('active'); $('.sec2-tab a').eq(subcount).addClass('active'); $('.sec2-contWrap .sec2-content').removeClass('active').eq(subcount).addClass('active'); $('.section2 .sec2-tab .moreBtn').attr('href', $('.sec2-tab a').eq(subcount).data().link); history.pushState(null, null, sectionUrl + "?section=" + wheelcount + "&InSection=" + subcount ); $('html').stop().animate({ 'scrollTop' : sectionArray[wheelcount] }, 300); /* $('.sec2-contWrap').stop().animate({ 'left' : '-' + subscroll + 'vw' }, 300); */ // navi if( wheelcount == 5 || wheelcount == 6 ){ $('.navi').css({ 'bottom' : $('.footer').outerHeight() }); $('.navi a:last-child').addClass('active'); }else{ $('.navi').css({ 'bottom' : 0 }); $('.navi a').removeClass('active').eq(wheelcount).addClass('active'); } }, 100); } }); if( getParameterByName('section') != '' ){ //파라미터가 있을때 wheelcount = getParameterByName('section'); subcount = getParameterByName('InSection'); //파라미터 history.pushState(null, null, sectionUrl + "?section=" + wheelcount + "&InSection=" + subcount ); if( isPC == true ){ $('html').stop().animate({ 'scrollTop' : sectionArray[wheelcount] }, 300); subscroll = subcount * 100; $('.sec2-contWrap').stop().animate({ 'left' : '-' + subscroll + 'vw' }, 300); $('.sec2-tab a').removeClass('active'); $('.sec2-tab a').eq(subcount).addClass('active'); // $('.sec2-tab a:first-child').on('blur', function(){ // $('.plan-slider .prev').focus(); // }); // // $('.plan-slider .next').on('blur', function(){ // // // $('.sec2-tab > a').removeClass('active'); // $('.sec2-tab > a:nth-child(2)').addClass('active'); // $('.sec2-tab > a:nth-child(2)').focus(); // history.pushState(null, null, sectionUrl + "?section=" + wheelcount + "&InSection=" + subcount ); // // $('.sec2-contWrap').stop().animate({ // 'left' : '-' + subscroll2 + 'vw' // }, 300); // }); // // $('.sec2-tab a:nth-child(2)').on('blur', function(){ // $('.eco-slider a:first-child').focus(); // }); // // $('.eco-slider a:last-child').on('blur', function(){ // $('.sec2-tab > a').removeClass('active'); // $('.sec2-tab > a:nth-child(3)').addClass('active'); // $('.sec2-tab > a:nth-child(3)').focus(); // history.pushState(null, null, sectionUrl + "?section=" + wheelcount + "&InSection=" + subcount ); // }); // // $('.sec2-tab a:nth-child(3)').on('blur', function(){ // $('.exhibition .txt .btn a').eq(0).focus(); // }); // // $('.exhibition .img a:last-child').on('blur', function(){ // $sec2_link.focus(); // }); // // $('.section2 .sec2-tab .moreBtn').on('blur', function(){ // $('.sec3-tab > a').eq(0).focus(); // }); } } //navi var $naviBtn = $('.navi a'); $naviBtn.removeClass('active').eq(wheelcount).addClass('active'); $naviBtn.on('click', function(){ if( isPC == true ){ $naviBtn.removeClass('active'); $(this).addClass('active'); wheelcount = $(this).index(); if( wheelcount == 0 ){ subcount = 0; }else if( wheelcount >= 2 ){ subcount = sec2_length; } subscroll = 100 * subcount; $('.sec2-tab a').removeClass('active'); $('.sec2-tab a').eq(subcount).addClass('active'); $sec2_link.attr('href', $('.sec2-tab a').eq(subcount).data().link); history.pushState(null, null, sectionUrl + "?section=" + wheelcount + "&InSection=" + subcount ); $('html').stop().animate({ 'scrollTop' : sectionArray[wheelcount] }, 300); $('.sec2-contWrap').stop().animate({ 'left' : '-' + subscroll + 'vw' }, 300); if( wheelcount == 5 || wheelcount == 6 ){ $('.navi').css({ 'bottom' : $('.footer').outerHeight() }); $('.navi a:last-child').addClass('active'); }else{ $('.navi').css({ 'bottom' : 0 }); $('.navi a').removeClass('active').eq(wheelcount).addClass('active'); } return false; } }); //section1 scrollBtn $('.scroll-down').on('click', function(){ wheelcount++; history.pushState(null, null, sectionUrl + "?section=" + wheelcount + "&InSection=" + subcount ); $('html').stop().animate({ 'scrollTop' : sectionArray[wheelcount] }, 300); return false; }); var $sec2_tabBtn = $('.sec2-tab a:not(.moreBtn)'), $sec2_link = $('.section2 .sec2-tab .moreBtn'), $sec2_content = $('.sec2-content'); // var sec2AnimateIndex = 0, // sec2Animate = setInterval(function(){ // if( sec2AnimateIndex >= $sec2_tabBtn.length - 1 ){ // sec2AnimateIndex = 0; // }else{ // sec2AnimateIndex++; // } // // $sec2_tabBtn.eq( sec2AnimateIndex ).trigger('click'); // }, 5000); $sec2_tabBtn.on('click', function(){ $sec2_tabBtn.removeClass('active'); $(this).addClass('active'); if( isPC == true ){ subscroll = $(this).index() * 100; subcount = $(this).index(); $('.sec2-contWrap').stop().animate({ 'left' : '-' + subscroll + 'vw' }, 300); history.pushState(null, null, sectionUrl + "?section=" + wheelcount + "&InSection=" + subcount ); $sec2_link.attr('href', $(this).data().link); }else{ $sec2_content.removeClass('active'); $sec2_content.eq( $(this).index() ).addClass('active'); } return false; }); //전시·행사 - 야외전시 var $exhibitBtn = $('.exhibition .txt .btn a'), $exhibit_MapBtn = $('.exhibition .img a'); $exhibitBtn.on('mouseover focus', function(){ $exhibitBtn.removeClass('active'); $(this).addClass('active'); $exhibit_MapBtn.removeClass('active'); $exhibit_MapBtn.eq($(this).index()).addClass('active'); }); $exhibit_MapBtn.on('mouseover focus', function(){ $exhibit_MapBtn.removeClass('active'); $(this).addClass('active'); $exhibitBtn.removeClass('active'); $exhibitBtn.eq($(this).index() - 1).addClass('active'); }); });