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

219
Views
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 answers
Answer question

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