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

222
Vistas
Slick: how to edit margin between slides?

I am wondering if its possible to create something like this using slick slider?

  +-------+ +-------+
  |       | |       |
  |    +-------+    |
  +----|       |----+
       |       |
       +-------+

The problem comes with setting margin between the slides. I found How add spaces between Slick carousel item which explains you can modify margin this way:

/* the slides */
 .slick-slide {
   margin: 0 27px;
 }

/* the parent */
 .slick-list {
   margin: 0 -27px;
 }

However, I am not able to change margin into a negative value, so that the 3rd element would be on top of two instead of just between them.

Did anyone happen to do this or knows any reference link that had something similar?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

So, if anyone is still interested, I was able to get what I wanted this way:

#wrapper {
    width: 100%;
    display: table;
    table-layout: fixed;
    border-collapse: collapse;
    padding: 10px; /* important !! */
}

.slick-slide { /* spacing in between each slide */
    margin: 0 -10px;
}

.slick-list { /* spacing in between the group of slides */
    padding: 0 20px; 
}

.slick-track { /* spacing for the slider itself */
    min-height: 600px;
}

.slide {
    position: relative;
    float: left;
}

.slide:nth-child(3n+2) {
    top: 10em;
    z-index: 1;
}

With these styles I was able to get what I was looking for. However, each first slide from the sibling list was still shown. So for that I went with a script, that basically hides inactive slides and only shows visible ones.

    $(document).ready(function(){

        /* runs only once */ 
        $(".slide").css({opacity: 0}); 
        $(".slick-active").css({opacity: 1});

        /* runs after slides are being changed */
        $('#wrapper').on('afterChange', function(event, slick, currentSlide, nextSlide){
            $(".slide").animate({opacity: 0}, 100); 
            $(".slick-active").animate({opacity: 1}, 300);
        });
    })
over 4 years ago · Santiago Trujillo 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