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

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

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 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