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

174
Views
Force Swiper.js to display only one slide on mobile viewport

I was working on a Swiper.js and I have the following HTML:

<div class="swiper-container">
    <div class="swiper-wrapper">
      <div class="swiper-slide">
          <img src="images/img1.jpg" alt="">
          <div class="slide-text">
            <h2>Slide One</h2>
            <a class="btn-slider" href="#">LEARN MORE &rarr;</a>
          </div>
      </div>
      <div class="swiper-slide">
        <img src="images/img2.jpg" alt="">
        <div class="slide-text">
         <h2>Slide Two</h2>
         <a class="btn-slider" href="#">LEARN MORE &rarr;</a>
        </div>
    </div>
    <div class="swiper-slide">
        <img src="images/img3.jpg" alt="">
        <div class="slide-text">
         <h2>Slide Two</h2>
         <a class="btn-slider" href="#">LEARN MORE &rarr;</a>
        </div>
    </div>
</div>

By default, you will have the following JS to make it work:

var swiper = new Swiper(".swiper-container", {
  autoplay: {
    slidesPerView: 1,
    disableOnInteraction: false,
  },
});

I was wondering if its possible to force Swiper.js to only display one slide on mobile viewport instead of showing all 3 slides on mobile?

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

0

YES, you can use breakpoints object alongside your autoplay, Like this

var swiper = new Swiper(".swiper-container", {
  autoplay: {
    slidesPerView: 1,
    disableOnInteraction: false,
  },
  breakpoints: {
    640: {
      slidesPerView: 1,
      spaceBetween: 20,
    },
    768: {
      slidesPerView: 2,
      spaceBetween: 40,
    },
    1024: {
      slidesPerView: 3,
      spaceBetween: 50,
    },
  },
});

Here Is The Documentation Example For Responsive Sliders

https://codesandbox.io/s/3blv5?file=/index.html

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!