amp-htmlamp-img

How do I disable amp-img default lightbox functionality?


I have a lot of <amp-img> elements on a client's site and recently noticed a feature where you can click the image and get a lightbox that pops out with an X in the upper-right corner. I can't find ANY mention on their official documentation about enabling/disabling this feature. I am using this element for some background/stylistic elements, so I'd rather users not be able to click it. Any help is much appreciated.

Here is the code I'm using, with classes and URLs removed:

<amp-img
    width="2000"
    height="515"
    layout="responsive"
    src="https://image.url">
    <amp-img placeholder
        src="https://placeholder.url"
        layout="fill">
    </amp-img>
</amp-img>

Solution

  • You can do so by adding data-amp-auto-lightbox-disable attribute on any element. For more info see this comment on Github.