amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

Resize Event not affecting width on amp-ad container

Open adtechnology opened this issue 10 years ago • 14 comments

Related to https://github.com/ampproject/amphtml/issues/1871 Since this is closed, open a new issue.

Height is tested again and work's fine now, but width doesn't proceed till the end. I'm calling window.context.requestResize(320,50); and the iframe itself is resized to 320/50 and height and width attributes of the amp-ad container also but the style looks like this:

width: 300px; height: 50px;

Width has not been actualized. Please fix.

You can check out on: http://adtechs.de/demopages/bild/bilddemo.html

adtechnology avatar Feb 22 '16 15:02 adtechnology

This is overdue on the Feb 19 milestone. Any update?

rudygalfi avatar Feb 22 '16 21:02 rudygalfi

To @sriramkrish85's defense I only put it on there this morning :)

Can you move to our next target?

cramforce avatar Feb 22 '16 21:02 cramforce

Whoops, missed that. :) Yeah, can definitely move into the next milestone.

rudygalfi avatar Feb 22 '16 21:02 rudygalfi

CC @dvoytenko Is this expected to work?

cramforce avatar Feb 22 '16 21:02 cramforce

Yes this should work.

camelburrito avatar Feb 23 '16 03:02 camelburrito

It seems http://adtechs.de/demopages/bild/bilddemo.html isn't doing any resizing

But just from looking at the code, I'd be pretty surprised if this actually works. @sriramkrish85 Could you build a demo. Ideally for both fixed size and responsive ads.

cramforce avatar Feb 23 '16 03:02 cramforce

Nvm , this does not work :) I was talking about a different resize bug . Will fix and build a demo as well

camelburrito avatar Feb 23 '16 03:02 camelburrito

I think iframes have similar code. Lets fix there as well. Also I find it a big questionable that we would change the width, but not the height. We probably should do either both or none.

cramforce avatar Feb 23 '16 03:02 cramforce

This is great news, I see that 'INTENT TO IMPLEMENT' label and makes my :heart: happy. Thanks y'all.

We've had to hack around this by adding an inner iframe sized to the correct width to get our ads to be responsive.

╔═══════════════════════════════╗
║            Article            ║
║                               ║
║                               ║
║ ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╬ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
║  ┌──────────────────────────┐ ║     amp-ad default iframe│
║ ││##########################│ ║
║  │##########################│ ║                          │
║ ││########### New ##########│ ║
║  │######### iFrame #########│ ║                          │
║ ││##########################│ ║
║  │##########################│ ║                          │
║ ││##########################│ ║
║  └──────────────────────────┘ ║                          │
║ └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╬ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
║                               ║
╚═══════════════════════════════╝

banderson623 avatar Feb 24 '16 21:02 banderson623

@banderson623 once PR #2263 is reviewed and submitted (and released to cdn). do Keep an eye on https://github.com/ampproject/amphtml/releases. (This will tell you when if the PR is on the latest release)

camelburrito avatar Feb 24 '16 21:02 camelburrito

Thanks @sriramkrish85 !

banderson623 avatar Feb 24 '16 21:02 banderson623

Hello, I am fairly new to this, so i am not sure if I should make a new issue or not. If so,let me know. I seem to have a similar problem and wondering if this has been fixed yet or what the fix is? I am using the window.context.requestResize function and it seems to work. However, there is an inline style that won't change to the new values. See screenshot.

Please help?

dump

Re-lM avatar Mar 17 '16 09:03 Re-lM

@Re-lM the inline style attribute seems to be updated. Do you mean with inline width and height? Any chance you could share the source code of this page?

@sriramkrish85 PTAL

dvoytenko avatar Mar 17 '16 17:03 dvoytenko

@dvoytenko I indeed mean the inline width and height. I see this thread has been closed. Should I make a new one?

This is the output <amp-ad width="0" height="0" type="improvedigital" data-placement="869276" data-optin="y" class="-amp-element -amp-layout-fixed -amp-layout-size-defined -amp-layout" id="AMP_2" style="width: 300px; height: 250px;"></amp-ad>

I resize the iframe when the ad has been served: `

`

The main purpose it to collapse the amp-ad container. I tried using: window.context.noContentAvailable but this will just remove the ad but not change the amp-ad container size. The size stays the same.

Re-lM avatar Mar 18 '16 09:03 Re-lM