October 2017
Intermediate to advanced
370 pages
8h 57m
English
AMP has a component that can help here: amp-carousel. This component is mostly used with images and galleries, as we'll see in the next chapter, but it can also be used to build a scrollable horizontal navigation bar.
First, we need to import the script. Add the following to the document head:
<script async custom-element="amp-carousel" src="https://cdn.ampproject.org/v0/amp-carousel-0.1.js"></script>
Basic amp-carousel usage looks like this:
<amp-carousel height="1.8rem" layout="fixed-height" type="carousel"> ...</amp-carousel>
The main thing to note here is the type attribute which can take one of the following values:
Read now
Unlock full access