Hi all,
I'm running against an issue with loading the TextFit function before the ad is loaded and running.
Last week I've made another topic to create dynamic elements in Hype to load Adcombi's text and image feed, in which @MarkHunte came with a magical solution.
One issue I found with working with dynamic text is that it quickly overflows when larger words or more characters are used then intended. Hence I found a cool text scaling library (TextFit.js) that scales down the font size to fit text into it's container.
Initially this worked great, however there are some issues when a little bit more characters are used then intended, It's overflowing at the bottom. The weird thing is that the issue appears in the initial first session when the assets aren't loaded yet (or when the cache is emptied (Cmd/shift/R), or is played in a different browser / incognito).
Once it's been loaded once, it will work properly when loaded again/refreshed. For comparison in this dummy project (red box = the text container):
Without TextFit:
With TextFit loaded for the first time:
When TextFit is loaded/cached once:
On prepare for display I'm running the TextFit function first, followed by the ParseHTML from the topic above.
Additional of doing it in the prepare for display, I've also tried it manually with an Event listener for the DOMContentLoaded. However, this resulted in the same result.
I figure the issue is that its not loading/refreshing properly in the initial load for some reason. Weirdly enough when I packaged/tested the creative in Google's HTML5 validator it didn't give any issues there, even with an emptied cache, since I think its waiting for the entire ad to load fully before serving it.
I hope someone has had an experience like this, or knows a good solution to let the banner wait to load fully before serving it, or perhaps refreshes the text element after some time to force it to format properly.
For the sake of an example, I've loaded dummy content in the banner to provide some files:
Hype project:
Hype_TextLoad.hype.zip (22.9 KB)
Clean package where Hype is implemented in the Adcombi format:
Adcombi_package.zip (137.3 KB)