Resize Event not affecting width on amp-ad container
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
This is overdue on the Feb 19 milestone. Any update?
To @sriramkrish85's defense I only put it on there this morning :)
Can you move to our next target?
Whoops, missed that. :) Yeah, can definitely move into the next milestone.
CC @dvoytenko Is this expected to work?
Yes this should work.
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.
Nvm , this does not work :) I was talking about a different resize bug . Will fix and build a demo as well
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.
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 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)
Thanks @sriramkrish85 !
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?

@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 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.