diff --git a/src/secureCreatives.js b/src/secureCreatives.js index df7abe4ebee..7584c5d2bf7 100644 --- a/src/secureCreatives.js +++ b/src/secureCreatives.js @@ -81,8 +81,9 @@ export function _sendAdToCreative(adObject, remoteDomain, source) { function resizeRemoteCreative({ adUnitCode, width, height }) { // resize both container div + iframe - ['div:last-child', 'div:last-child iframe'].forEach(elmType => { - let element = getElementByAdUnit(elmType); + ['div', 'iframe'].forEach(elmType => { + // not select element that gets removed after dfp render + let element = getElementByAdUnit(elmType + ':not([style*="display: none"])'); if (element) { let elementStyle = element.style; elementStyle.width = width + 'px';