CMS솔루션마켓, 이온디 - 워드프레스, 라이믹스, 카페24, 그누보드, 엑셀

블로그

1. 마우스 감도

threshold:100,


[code]

$(function(){

   var elePrSwiper = '.pr-swiper';
   var activeSlide = '.swiper-slide-visible';
   var setTime1, setTime2, setTime3, setTime4, clear;
   var clear = function(){
      clearTimeout(active);
      clearTimeout(setTime1);
      clearTimeout(setTime2);
      clearTimeout(setTime3);
      clearTimeout(setTime4);
   }
   var active = function(){
      // $(activeSlide).find('.inner-slide').removeClass('on');

      // setTime1 = setTimeout(function(){
      //     // $(elePrSwiper).find('.swiper-slide:nth-child(3n-2)').addClass('focus').siblings().removeClass('focus');
      //     $(activeSlide).find('.inner-slide:nth-child(3n-2)').addClass('on');
      // },0)
      // setTime2 = setTimeout(function(){
      //     $(activeSlide).find('.inner-slide:nth-child(3n-2)').removeClass('on');
      //     $(activeSlide).find('.inner-slide:nth-child(3n-1)').addClass('on');
      // },1000)
      // setTime3 = setTimeout(function(){
      //     $(activeSlide).find('.inner-slide:nth-child(3n-1)').removeClass('on');
      //     $(activeSlide).find('.inner-slide:nth-child(3n)').addClass('on');
      // },2000)
      // clear = setTimeout(function(){
      //     // $(elePrSwiper).find('.swiper-slide').removeClass('focus');
      // },3000)
      
      var item = $(activeSlide).find('.inner-slide');
      setTime1 = setTimeout(function(){
         $('.inner-slide').removeClass('on');
         $(item).eq(0).addClass("on");
      },0);
      setTime2 = setTimeout(function(){
         if($(item).eq(0).hasClass('on')){
            $(item).eq(1).addClass('on').siblings().removeClass('on');
         }
      },1000);
      setTime3 = setTimeout(function(){
         if($(item).eq(1).hasClass('on')){
            $(item).eq(2).addClass("on").siblings().removeClass('on');
         }
      },2000);
      setTime4 = setTimeout(function(){
         if($(item).eq(2).hasClass('on')){
            $(item).eq(3).addClass("on").siblings().removeClass('on');
         }
      },3000);
      
   }
   var prSwiper = new Swiper(elePrSwiper + ' .swiper-container', {
      // slidesPerView: 'auto',
      // centeredSlides: true,
      // spaceBetween: 2,
      // speed:300, // 기본 넘어가는 슬라이드 속도
      // followFinger:false,
      // allowTouchMove:false, // 터치슬라이딩 기능 막음.
      
   threshold:100,
      loop:true,
      direction: 'vertical',
      slidesPerView: 1,
      slidesPerGroup: 1,
      // slidesPerColumn: 1,
      watchSlidesVisibility: true,
      autoplay: {
         delay: 3000,
      },
      
      on : {
         init: function(){
            active();
         },
         slideChangeTransitionEnd: function(){
            active();
         }
      },
   });
   $(".inner-slide").on('mouseover', function(){
      // clearTimeout(setTime1);
      // clearTimeout(setTime2);
      // clearTimeout(setTime3);
      // clearTimeout(setTime4);
      clear();
      $('.inner-slide').removeClass('on');
      // $(this).removeClass('off').siblings().addClass('off').removeClass('on');
      $(this).addClass('on').siblings().removeClass('on').addClass('off');
      prSwiper.autoplay.stop ();
   })
   $(".inner-slide").on('mouseleave', function(){
      clear();
      // $(this).removeClass('off').siblings().removeClass('off').removeClass('on');
      $(".inner-slide").removeClass('off').removeClass("on");
      active();
      prSwiper.autoplay.start ();
   })
   
   
})

[]