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

221
Vistas
the breakpoints in slider splide js do not work

I am working with the slider plugin Splide JS. And I pass the options like this (full render slider):

let custom_slider = new Splide(".custom_slider");

custom_slider.mount();

if (custom_slider.length === 2) {
    custom_slider.options = {
        perPage: 2,
        breakpoints: {
            550: {
                perPage: 1,
            },
        },
    };
}

All of the above options work, except for the breakpoints. And I really don't understand why this happens.

I'm trying to assign specific options depending on the installed slides count, getting it like this - custom_slider.length.

It's all good, it works, BUT NOT the breakpoint options.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can try the following code:

let splide_length = document.querySelectorAll('.custom_slider .splide__slide').length;

if ( splide_length === 2 ) {

    let custom_slider = new Splide(".custom_slider", {
            perPage: 2,
            breakpoints: {
                550: {
                    perPage: 1,
                },
            },
        }).mount();

    } else {
    let custom_slider = new Splide(".custom_slider").mount();
}
    
about 4 years ago · Juan Pablo Isaza Denunciar
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