Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

263
Vistas
Swiper.js with lazy image loading initiating at the wrong height on mobile

I have updated my website to have lazy loading images with swiper.js.

When the page loads and swiper is initiated, swiper sets the height of the div containing the slides wrong. Its briefly sets the height to 460px which is the hieght on desktop. When the images are loaded the height is then updated to 186px which is correct for mobile.

I only noticed this after lazy loading was setup.

How can I stop swiper initiating at the wrong size?

This is what it looks like briefly for a second. Example

The slide image is prefilled with a placeholder image, width 1200px, height 460px. Then CSS setting the image to width 100% and height auto;

This is my script.

    const myswiperban = new Swiper('.swiper-container-ban-wide', {
            loop: true,
            pagination: {
                el: '.swiper-pagination-ban-wide',
                clickable: true
            },
            navigation: {
                nextEl: '.swiper-button-next-ban-wide',
                prevEl: '.swiper-button-prev-ban-wide',
            },
            slidesPerView:1,
            freeMode:true,
            autoplay: {
                delay: 3000
            },
            autoHeight:true,
            preloadImages: false,
            lazy: {
                loadPrevNext: true
            },
    });

Any ideas?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda