1

I have Swiper slider in react.js

<Swiper
    modules={[EffectFade, Pagination]} 
    effect="fade" 
    slidesPerView={1} 
    loop={true} 
    autoplay={{ delay: 4000 }}
    pagination={{
     clickable: true,
     type: 'bullets', // set pagination type to 'bullets'
     dynamicBullets: true // create dynamic number of dots based on number of slides
   }}>

but it is not working, I watched some video and it is exactly same but not working, I also tried setting autoplay to default true

autoplay={true}

but it is not working anyway. any tips?

2 Answers2

0

for anyone out there having same problem. I imported these


import SwiperCore from 'swiper'
import { Autoplay } from 'swiper';

and this did the job

SwiperCore.use([Autoplay]);
0

Did you install the autoplay module?

ref: https://swiperjs.com/swiper-api#using-js-modules

import Swiper from 'swiper';
import { Autoplay } from 'swiper/modules'
Swiper.use([Autoplay]);
Keita Ono
  • 71
  • 1
  • 5