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

340
Vistas
Swiper slider, how to reduce the width of the scrollbar

JavaScript

 const projectsSwiper = new Swiper(".projects__swiper-start", {
       speed: 1000,
    
             slidesPerView: 3,
    
             navigation: {
                nextEl: ".projects__swiper-next",
                prevEl: ".projects__swiper-prev",
             },
       watchOverFlow: true,
       simulateTouch: true,
    
       spaceBetween: 19,
    
       scrollbar: {
          el: ".projects__swiper-scroll",
          draggable: true,
          dragSize: 80,
       },
    });

HTML

<div class="projects__swiper-start swiper">
    <div class="projects__swiper swiper-wrapper">
        <div class="projects__swiper-slide swiper-slide">
            <div class="projects__swiper-img">
                <img src="images/projects/slide-1.jpg" alt="slide-1" />
            </div>
        </div>
        <div class="projects__swiper-slide swiper-slide">
            <div class="projects__swiper-img">
                <img src="images/projects/slide-2.jpg" alt="slide-2" />
            </div>
        </div>
        <div class="projects__swiper-slide swiper-slide">
            <div class="projects__swiper-img">
                <img src="images/projects/slide-3.jpg" alt="slide-3" />
            </div>
        </div>
        <div class="projects__swiper-slide swiper-slide">
            <div class="projects__swiper-img">
                <img src="images/projects/slide-4.jpg" alt="slide-4" />
            </div>
        </div>
    </div>
</div>

Now I have scrolled in full width, but I need to reduce it to 300px and place it in the center, as I found the slider to reduce, but with the width of the scroll, there is a problem.

Thank you very much in advance!

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

0

dragSize - Size of scrollbar draggable element in px.

enter image description here

No API option to control the width of swiper-scrollbar (The wrapper). If you change this by custom CSS you destroy the way the scrollbar works.

/* will not work as it should */
.swiper-horizontal .swiper-scrollbar{
  width: 50%!important;
}

You should open Github Feature Req related to this idea: https://github.com/nolimits4web/swiper/issues

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