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

111
Views
How do I Lazy Load Gatsby-Plugin-Image with Swiper?

Currently when I load my slider from swiper.js gatsby image automatically loads all of the images even though they are not visible to the end user. This is not the behavior I want. I want to only load the images for the slide visible or thumbnail slides visible. Does anyone have a solution for this?

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

0

It should be managed automatically since Gatsby adds the lazy loading by default.

  • In gatsby-image (v2): the loading property controls this behavior.

    Set the browser’s native lazy loading attribute. One of lazy, eager or auto. Defaults to lazy.

  • In gatsby-image-plugin (v3): the same loading property controls this behavior:

    Loading behavior for the image. You should set this to "eager" for above-the-fold images to ensure they start loading before React hydration. Defaults to lazy.

In Swiper, in addition, you have a bunch of properties that you can lift to the Swiper component, in your case, lazy is what you are looking for:

  let params = {
    // other props
    lazy: true,
  };

Then just use it like:

  <Swiper {...params}>
   // your slides here
  </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!