in src/lib/messenger/passback.ts [267:315]
function (
event: googletag.events.SlotRenderEndedEvent,
) {
const slotId = event.slot.getSlotElementId();
if (slotId === passbackElement.id) {
const size = event.size;
if (Array.isArray(size) && size[1]) {
const adHeight = size[1];
log(
'commercial',
`Passback: ad height is ${adHeight}`,
);
void fastdom.mutate(() => {
const slotHeight = `${
(getCurrentBreakpoint() === 'mobile'
? adHeight
: adSizes.outstreamDesktop
.height) + adLabelHeight
}px`;
log(
'commercial',
`Passback: setting height of passback slot to ${slotHeight}`,
);
slotElement.style.height = slotHeight;
/**
* The centre styling is added in here instead of where the element is created
* because googletag removes the display style on the passbackElement
*/
passbackElement.style.display = 'flex';
passbackElement.style.flexDirection =
'column';
passbackElement.style.justifyContent =
'center';
passbackElement.style.alignItems =
'center';
passbackElement.style.height = `calc(100% - ${adLabelHeight}px)`;
/**
* Also resize the initial outstream iframe so it doesn't block text selection
* directly under the new ad
*/
iframe.style.height = slotHeight;
iFrameContainer.style.height =
slotHeight;
});
}
}
},