Amphtml: improving amp-image-lightbox for desktop

Created on 15 Sep 2019  路  7Comments  路  Source: ampproject/amphtml

Describe the new feature or change to an existing feature you'd like to see

When AMP is used in desktop version the amp-image-lightbox effect cause small images to stretch. Images tends to fill the whole screen but in desktop this feature makes images ugly. Is there any way not to exceed width and height of images?

Describe alternatives you've considered

Provide a clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context or screenshots about the feature request here.

amp-lightbox-gallery DiscussioQuestion components

Most helpful comment

@2shrestha22

You can disable auto lightbox by setting the data-amp-auto-lightbox-disable attribute on any element. Set it on <body> to disable for the whole document.

Additionally, if you include the amp-lightbox-gallery extension script and use it explicitly by setting the lightbox attribute on a valid element, auto-lightbox won't apply.

All 7 comments

^^ I think the whole point of the lightbox is to provide a higher resolution image to the user on click. so you need to supply a higher resolution pic and if not, you don't need a lightbox.

I could be wrong tho.

Yes it is. But the things is that lightbox is enabled by default in all images including featured image and small screenshots images that I use. Any way to avoid auto enabled lightbox?

Are you sure you are not talking about amp-image-gallery ? With amp-img-lightbox you have to manually specify which images to be lightboxed.

Yes; it was not happening before. I was manually enabling lightbox effect while editing post. Here is my site - https://sangams.com.np/

@2shrestha22

You can disable auto lightbox by setting the data-amp-auto-lightbox-disable attribute on any element. Set it on <body> to disable for the whole document.

Additionally, if you include the amp-lightbox-gallery extension script and use it explicitly by setting the lightbox attribute on a valid element, auto-lightbox won't apply.

@alanorozco

Thanks for the solution. Is it possible to makes image not fill the width and height instead show actual size of image.

@2shrestha22 I think that's probably a better use case for amp-lightbox than for amp-image-lightbox or amp-lightbox-gallery. Would styling your image for amp-lightbox work in this case?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

samanthamorco picture samanthamorco  路  3Comments

radiovisual picture radiovisual  路  3Comments

choumx picture choumx  路  3Comments

aghassemi picture aghassemi  路  3Comments

edhollinghurst picture edhollinghurst  路  3Comments