var swiper1 = new Swiper('.core-swiper-1', { speed: 1000, effect: 'fade', spaceBetween: 30, centeredSlides: true, loop: true, slidesPerView: 1, touchMoveStopPropagation: true, // grabCursor: true, // autoplay: { // delay: 4000, // disableOnInteraction: false // }, pagination: { el: '.swiper-pagination', clickable: true }, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev' } }); var swiper2 = new Swiper('.core-swiper-2', { speed: 1000, effect: 'fade', spaceBetween: 30, centeredSlides: true, loop: true, slidesPerView: 1, touchMoveStopPropagation: true, // grabCursor: true, // autoplay: { // delay: 4000, // disableOnInteraction: false // }, pagination: { el: '.swiper-pagination', clickable: true }, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev' } }); var swiper3 = new Swiper('.core-swiper-3', { speed: 1000, effect: 'fade', spaceBetween: 30, centeredSlides: true, loop: true, slidesPerView: 1, touchMoveStopPropagation: true, // grabCursor: true, // autoplay: { // delay: 4000, // disableOnInteraction: false // }, pagination: { el: '.swiper-pagination', clickable: true }, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev' } }); $('.core-swiper-1').on('mouseover', function() { swiper2.autoplay.stop(); }); $('.core-swiper-1').on('mouseout', function() { swiper2.autoplay.start(); }); $('.core-swiper-2').on('mouseover', function() { swiper2.autoplay.stop(); }); $('.core-swiper-2').on('mouseout', function() { swiper2.autoplay.start(); }); $('.core-swiper-3').on('mouseover', function() { swiper2.autoplay.stop(); }); $('.core-swiper-3').on('mouseout', function() { swiper2.autoplay.start(); }); //슬라이드 바뀔때마다 탭 글자 배경색 변환 swiper1.on('slideChange', function() { $('.imgtitle') .eq(swiper1.realIndex) .addClass('select'); $('.imgtitle') .eq(swiper1.realIndex) .siblings() .removeClass('select'); }); swiper2.on('slideChange', function() { $('.imgtitle') .eq(swiper2.realIndex + 3) .addClass('select'); $('.imgtitle') .eq(swiper2.realIndex + 3) .siblings() .removeClass('select'); }); swiper3.on('slideChange', function() { $('.imgtitle') .eq(swiper3.realIndex + 6) .addClass('select'); $('.imgtitle') .eq(swiper3.realIndex + 6) .siblings() .removeClass('select'); }); $(document).ready(function() { $window = $(window); // 다음 섹션이 브라우저 하단으로부터 30px 만큼 보여질때 var delayPosition = 30, // 현재 브라우저의 높이값 windowheight; // 브라우저의 크기가 변하면 대상 엘리먼트의 위치값을 다시 할당 $window.on('resize', function() { insertTargetPosition(); }); // 스크롤이 이동할때 $window.on('scroll', function() { // 현재의 위치 = 스크롤이 이동한 값 + 윈도우 높이 - 처음에 선언한 지연 위치값(200); var position = $window.scrollTop() + windowheight - delayPosition; if ($('.c1').data('offsetTop') < position) swiper1.autoplay.start(); if ($('.c2').data('offsetTop') < position) swiper2.autoplay.start(); if ($('.c3').data('offsetTop') < position) swiper3.autoplay.start(); }); function insertTargetPosition() { windowheight = $window.height(); // 브라우저의 높이값 할당 $('.c1').data('offsetTop', $('.c1').offset().top); // 각자의 위치 값을 할당 $('.c2').data('offsetTop', $('.c2').offset().top); // 각자의 위치 값을 할당 $('.c3').data('offsetTop', $('.c3').offset().top); // 각자의 위치 값을 할당 } (function init() { insertTargetPosition(); })(); }); //클릭시 슬라이드 변경 function changeslide(slideindex, index) { if (slideindex == 1) swiper1.slideTo(index); else if (slideindex == 2) swiper2.slideTo(index); else swiper3.slideTo(index); } function fnMove(seq) { var offset = $('#core_' + seq).offset(); $('html, body').animate({ scrollTop: offset.top - 60 }, 400); }