Skip to content

amp-ad : centering image in flying-carpet #8097

@coreybyrnes

Description

@coreybyrnes

I'm trying to horizontally and vertically center a DFP ad in the flying-carpet component when the image in the ad is larger than the flying-carpet container. For my test case the ad size for my creative is 1600x1000 and I'm serving a 1600x1000 image. It looks like if I could somehow resize the tag upon load from 1600x1000 to 100vw and 100vh it would sit perfectly centered in both portrait and landscape modes. From what I understand requestResize is only available upon user interaction. Is there any other way to manipulate the dimensions of the tag at the time the ad loads so I can get this to work? Perhaps I have to do it through an 'amp-3p-iframe-src' js? Thanks!

To reproduce, simply modify the width and height of the tag to 100vw and 100vh in the browser developer tools at the following test url:
http://rev.cbsi.com/corey/test/amp/amp_demo_flying-carpet_v2.html

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions