The amp-carousel component is used to make an image/content carousel in AMP HTML along the horizontal axis. A carousel is a slideshow of images through a series of images.
Required Scripts: Importing the amp-carousel component in the header.
- type: It specifies the type of carousel. By default, type is set as carousel (all slides scroll horizontally, slides could have different CSS here). It could also be set as slide (single slide shown at a time).
- control: It displays the left and right arrows for user navigation.
- autoplay: When we use this attribute, it moves the carousel on its own.
- loop: Using loop attribute a loop is made i.e. there is right control in the last slide and left control in the first.
- delay: Duration of display of next slide by default it is set as 5000ms and delay cannot be less than 1000ms.
- slide: It is used to specify which slide should go first.
Example 1: Using type=”slides” to display a list of images as slides.
Example 2: Using autoplay attribute with a delay of 3000ms.