Ask Your Question
2

How can I display only one item in Bootstrap Multi Carousel on mobile devices?

asked 2021-07-07 11:00:00 +0000

qstack gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2022-01-26 12:00:00 +0000

bukephalos gravatar image

You can set the number of visible items in the Bootstrap Multi Carousel by changing the value of the "items" option. To display only one item on mobile devices, you can use media queries to modify the "items" option depending on the screen size.

Here's an example of how you can achieve this:

HTML:

<div class="multi-carousel">
  <div class="carousel-item">Item 1</div>
  <div class="carousel-item">Item 2</div>
  <div class="carousel-item">Item 3</div>
  <div class="carousel-item">Item 4</div>
  <div class="carousel-item">Item 5</div>
</div>

JavaScript:

$(document).ready(function() {
  $('.multi-carousel').multiCarousel({
    items: 3, // number of visible items
    responsive: {
      768: {
        items: 2 // change the number of visible items on tablet screens
      },
      576: {
        items: 1 // change the number of visible items on mobile screens
      }
    }
  });
});

In this example, the carousel will display 3 items on desktop screens, 2 items on tablet screens, and 1 item on mobile screens. You can adjust the media queries and the number of visible items to fit your specific needs.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-07-07 11:00:00 +0000

Seen: 10 times

Last updated: Jan 26 '22