Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show multiple column on AMP carousel

From what I've learned about <amp-carousel> it has only 2 types of carousel interface: carousel and slides, which you can see on the AMP example website. I need to create something like this, multiple columned carousel. Is AMP carousel able to achieve this?

Regular carousel

like image 944
Rizki Pratama Avatar asked Jun 06 '26 14:06

Rizki Pratama


1 Answers

You can't customize amp-carousel the way you want, you need to check out amp-base-carousel which allows you to set visible-count, advance-count and other useful properties.

The documentation.

Example :

 <amp-base-carousel
  loop="true"
  height="450"
  layout="fixed-height"
  visible-count="(min-width: 1150px) 3, (min-width: 700px) 2, 1"
  advance-count="(min-width: 1150px) 3, (min-width: 700px) 2, 1"
>
  <div>slide1</div>
  <div>slide2</div>
  <div>slide3</div>
  <div>slide4</div>
  <button slot="next-arrow" class="carousel-next" aria-label="Next">
    <i class="fas fa-chevron-circle-right"></i>
  </button>
  <button slot="prev-arrow" class="carousel-prev" aria-label="Previous">
    <i class="fas fa-chevron-circle-left"></i>
  </button>
</amp-base-carousel>

With some style for the buttons :

.carousel-prev, .carousel-next {
          filter: drop-shadow(0px 1px 2px #4a4a4a);
          width: 40px;
          height: 40px;
          padding: 20px;
          background-color: transparent;
          border: none;
          outline: none;
          font-size: 24px;
          opacity:0.7;
}
like image 131
Stephane L Avatar answered Jun 10 '26 10:06

Stephane L



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!