jeudi 17 juin 2021

Swiper js pagination not showing up in my ruby on rails project

My code :

  1. application.js
const mySwiper = new Swiper('.swiper-container', {
spaceBetween: 16,
loop: false,
grabCursor: true,
pagination: {
              el: '.swiper-pagination',
              clickable: true,
          },
          breakpoints: {
              640: {
                  slidesPerView: 2,
              },
              1024: {
                  slidesPerView: 3,
              },
          }
      })
}

js imports js improrts

2.html

 <div class="swiper-container">
    <div class="swiper-wrapper">
      <div class="swiper-slide">Slide 1</div>
      <div class="swiper-slide">Slide 2</div>
      <div class="swiper-slide">Slide 3</div>
      <div class="swiper-slide">Slide 4</div>
    </div>
    <div class="swiper-pagination"></div>
 </div>

imported it into the application.scss

stylesheets file

stylesheets imports

Aucun commentaire:

Enregistrer un commentaire