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

126
Vistas
Swiper js slidesPerView: "auto" goes off the window when swiping

I am trying to achieve this layout but when I try at first it seems ok but when you swipe, slide goes off. I want the active slide width to be 50% and others 25% at any window size except mobile. Layout

My scss looks like this. (I tried to change the active slide's width to 50% and others to 25%)

.newsSlider {
.swiper-slide {
    overflow: hidden;
    transition: 0.3s ease-in-out;
    width: 25%;

    .news-item {
        transition: 0.3s ease-in-out;
        width: 400px;
        height: 500px;
        overflow: hidden;
        position: relative;

        .news-floater {
            position: absolute;
            left: 0;
            bottom: 3rem;
            color: #fff;
            width: 100%;
            padding: 0 1rem 0 2rem;
            pointer-events: none;
            z-index: 2;

            .title {
                background-color: #cb2828;
                font-weight: bold;
                font-size: 1.3rem;
                text-transform: uppercase;
            }

            .news-title {
                font-size: 1.5rem;
                font-weight: bold;
            }

            .news-text {
                position: relative;
            }
        }

        img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transform: scale(1.2) translateX(0);
            transition: 5s ease-in-out;
        }
    }

    &.swiper-slide-active {
        width: 50%;

        .news-item {
            width: 100%;
            transition: 0.3s ease-in-out;

            .news-floater {
                pointer-events: all;
            }

            img {
                transform: scale(1.3) translateX(20px);
            }
        }
    }
}

}

Here is the demo: https://codepen.io/Xteripus/pen/yLpbJmQ

about 4 years ago · Juan Pablo Isaza
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