search

Home  >  Q&A  >  body text

How do I center align this card?

I'm having a problem with a card made with swiperjs. I'm trying to center the card on the mobile screen but I can't. Please help me solve this problem.

var swiper = new Swiper(".slide-content", {
  slidesPerView: 3,
  spaceBetween: 30,
  loop: true,
  centerSlide: 'true',
  fade: 'true',
  grabCursor: 'true',
  pagination: {
    el: ".swiper-pagination",
    clickable: true,
  },
  navigation: {
    nextEl: ".swiper-button-next",
    prevEl: ".swiper-button-prev",
  },
});

P粉851401475P粉851401475295 days ago663

reply all(1)I'll reply

  • P粉878510551

    P粉8785105512024-04-01 09:14:28

    var swiper = new Swiper(".slide-content", {
      slidesPerView: 1, // Set the number of visible slides to 1
      loop: true,
      centerSlides: true, // Use 'centerSlides' instead of 'centerSlide'
      fadeEffect: true, // Use 'fadeEffect' instead of 'fade'
      grabCursor: true,
      pagination: {
        el: ".swiper-pagination",
        clickable: true,
      },
      navigation: {
        nextEl: ".swiper-button-next",
        prevEl: ".swiper-button-prev",
      },
    });

    reply
    0
  • Cancelreply