Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

255
Views
How to set initial active slide to different index in swiperjs ReactJS?

I want to set the index of the swiper's active slide to the center position? As you can see in picture the active index is set to 0, I want it be number 3, i.e: middle and it should remain middle

 <Swiper
      grabCursor={true}
      spaceBetween={10}
      modules={[Navigation, Thumbs]}
      slidesPerView={7}
    //  activeSlideKey={3}
      slideActiveClass={styles.activeSlider}
    >
      {options.map((option) => () => <SwiperSlide key={option}>{option}</SwiperSlide>)}
    </Swiper>

activeSlideKey is just for reference. It does not work.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Very simple.

Use API Parameter initialSlide (0 == first slide, 1 == second slide and so on) - Index number of initial slide. https://swiperjs.com/swiper-api#param-initialSlide

      <Swiper
        initialSlide="3"
        navigation={true}
        modules={[Navigation]}
        className="mySwiper"
      >

Combine if you want with centeredSlides ={true} & loop={true}.

Centered demo: https://swiperjs.com/demos#centered

about 4 years ago · Juan Pablo Isaza Report

0

<Swiper
centeredSlides ={true}
>
...
</Swiper>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!