$(window).on('load',function(){
  // ローディングアニメーション
  const handle = (event) => {
    event.preventDefault();
  }
  var webStorage = function () {
    if (sessionStorage.getItem('access')) {
      $("body").addClass('access2-animation');
      // console.log('2回目以降のアクセスです');
      setTimeout(function () {
        $("body").addClass('loading2-end');
      }, 200);
      const mvSlide = new Swiper('.mv-slide.swiper', {
        effect: 'fade',
        loop: true,
        autoplay: {
          delay: 4000,
          disableOnInteraction: false,
        },
        speed: 2000,
        pagination: {
          el: ".swiper-pagination",
          clickable: true,
        },
      });
    } else {
      sessionStorage.setItem('access', 'true');
      $("body").addClass('loading1-animation');
      document.addEventListener('touchmove', handle, { passive: false });
      document.addEventListener('mousewheel', handle, { passive: false });

      setTimeout(function () {
        $("body").addClass('loading1-end');
        const mvSlide = new Swiper('.mv-slide.swiper', {
          effect: 'fade',
          loop: true,
          autoplay: {
            delay: 4000,
            disableOnInteraction: false,
          },
          speed: 2000,
          pagination: {
            el: ".swiper-pagination",
            clickable: true,
          },
        });
      }, 2000);

      setTimeout(function () {
        document.removeEventListener('touchmove', handle, { passive: false });
        document.removeEventListener('mousewheel', handle, { passive: false });
      }, 3000);
      // console.log('最初のアクセスです');
    }
  }
  webStorage();
});

// const mvSlide = new Swiper('.mv-slide.swiper', {
//   effect: 'fade',
//   loop: true,
//   autoplay: {
//     delay: 4000,
//     disableOnInteraction: false,
//   },
//   speed: 2000,
//   pagination: {
//     el: ".swiper-pagination",
//     clickable: true,
//   },
// });

const shopSlide = new Swiper('.shop-slide.swiper', {
  centeredSlides: true,
  loop: true,
  speed: 500,
  slidesPerView: 1.5,
  autoplay: {
    delay: 3000,
    disableOnInteraction: false,
    waitForTransition: false,
  },
  navigation: {
      nextEl: '.swiper-button-next',
      prevEl: '.swiper-button-prev',
  },
  breakpoints: {
    768: {
        slidesPerView: 1.8,
    },
    1024: {
        slidesPerView: 2,
    }
  },
});

