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

184
Vistas
Slick Slider React - How to keep the same width and space whatever the size screen?

I am creating a slider in react with Slick Slider. The problem is: when the screen size changes, the slides reduce in size or stack on top of each other.

Slick slider offers :

      responsive: [
        {
          breakpoint: 1024,
          settings: {
            slidesToShow: 3,
            slidesToScroll: 3,
            infinite: true,
            dots: true
          }, 
    …
      ]

But this does not prevent the change in size of the slides and does not fix the margin between the slides which are constantly changing.

I tried :

.slick-slide {
  width: auto !important;
}

In the CSS file, but then the slides accumulate one under the other, generating 4 rows instead of 2. Also, the animation is too large and create a blank space at the end of the slider.

Is it possible to create a slider with slides, that keep the same size and space between them whatever the size of the window? A way to keep a fixed size of slides, showing only the number of slides possible on the screen and showing only a part (or not) of the following slides?

So as to be responsive as well. What is wanted : enter image description here

Here is my code :

      const settings = {
        rows: 2,
        slidesPerRow: 1,
        slidesToShow: 3.2,
        infinite: false,
        swipeToSlide: true,
        slidesToScroll: 1,
        lazyLoad: true,
        responsive: [
            {
              breakpoint: 1200,
              settings: {
                  slidesToShow: 2.5,
                  slidesToScroll: 2,
              }
            },
            {
                breakpoint: 1024,
                settings: {
                    slidesToShow: 2,
                    slidesToScroll: 2,
                }
            },
            {
                breakpoint: 768,
                settings: {
                    slidesToShow: 1.7,
                    slidesToScroll: 1,
                    arrows: false                }
            },
            {
                breakpoint: 480,
                settings: {
                    slidesToShow: 1.4,
                    slidesToScroll: 1,
                    arrows: false
                }
            }
        ]

      };
     
      return (
        <>
          <h2>…</h2>
          <div className="cell">
            <Slider {...settings}>
                {
                    this.props.data.nodes.map((node,key) => (
                        <Cell node={node} key={key} />
                    ))
                } 
            </Slider>
          </div>
        </>
      );

Thank you!

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

0

ex)

4 slides in 1800px

slidesToShow: _.round((width * 4) / 1800, 1 or 2);

or

https://react-slick.neostack.com/docs/example/variable-width/

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