Is there any way to manual trigger action on AMP? For example I have a carousel and I would like to manually change slide index https://amp.dev/documentation/components/amp-carousel/?format=websites#gotoslide(index=integer)
there is a goToSlide action, but I only found execution on amp elements, but what if I would like to do this with VUE or VanillaJS? e.g.
<amp-carousel type="slides"
width="450"
height="300"
controls
loop
autoplay
delay="3000" data-next-button-aria-label="Go to next slide"
data-previous-button-aria-label="Go to previous slide"
role="region"
aria-label="Looping carousel">
<amp-img src="/static/inline-examples/images/image1.jpg"
width="450"
height="300"></amp-img>
<amp-img src="/static/inline-examples/images/image2.jpg"
width="450"
height="300"></amp-img>
<amp-img src="/static/inline-examples/images/image3.jpg"
width="450"
height="300"></amp-img>
</amp-carousel>
<button id="test">Change<button>
And JS Code:
const index = 10;
const button = document.querySelector('#button');
button.addEventListener('click', () => {
// trigger `goToSlide` with index arg
})