如何禁用amp-img默认灯箱功能?

问题描述 投票:0回答:1

我在客户的网站上有很多<amp-img>元素,最近注意到了一项功能,您可以单击该图像并获得一个灯箱,该灯箱在右上角带有X弹出。我在他们的official documentation中找不到任何有关启用/禁用此功能的信息。我将此元素用于某些背景/文体元素,所以我希望用户无法单击它。非常感谢您的帮助。

这是我正在使用的代码,其中删除了类和URL:

<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>
amp-html amp-img
1个回答
0
投票

您可以通过在任何元素上添加data-amp-auto-lightbox-disable属性来实现。有关更多信息,请参见this comment on Github

© www.soinside.com 2019 - 2024. All rights reserved.