Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

112
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda