Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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>
like image 329
brons Avatar asked Oct 18 '25 00:10

brons


1 Answers

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

like image 126
Sebastian Benz Avatar answered Oct 21 '25 20:10

Sebastian Benz



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!