Last active
March 14, 2023 15:45
-
-
Save pontusarmini/99f40010e84a552940872ad51aa58aed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function styleDoubleFullscreen(element) { | |
// Get bazaar-ad children | |
var children = element.querySelectorAll("div,iframe"); | |
// Style bazaar-ad | |
element.style.setProperty("height", "calc(200vh + 30px)"); | |
// for desktop | |
if (window.innerWidth > 500) { | |
element.style.setProperty("width", "100vw"); | |
element.style.setProperty("left", "-50vw"); | |
element.style.setProperty("margin-left", "500px"); | |
element.style.setProperty("margin-right", "0px"); | |
} else { | |
// Set to 100% instead of 100vw to not cause horizontal overflow | |
element.style.setProperty("width", "100%"); | |
} | |
// Style bazaar-ad > div | |
children[0].style.setProperty("position", "relative"); | |
children[0].style.setProperty("height", "200vh", "important"); | |
if (_export_isNettavisen_) { | |
children[0].classList.add("bazaar-parallax-label-x2"); | |
} else { | |
children[0].classList.add("am-bazaar-ad--labeled"); | |
} | |
// Style bazaar-ad > div > iframe | |
children[1].style.setProperty("width", "inherit"); | |
children[1].style.setProperty("height", "inherit"); | |
children[1].style.setProperty("left", "0"); | |
children[1].style.setProperty("position", "absolute"); | |
children[1].style.setProperty("top", "0"); | |
// Style bazaar-ad > div > div | |
children[2].style.setProperty("position", "sticky"); | |
children[2].style.setProperty("top", "0"); | |
children[2].style.setProperty("height", "100vh", "important"); | |
// Style bazaar-ad > div > div > iframe | |
// Set to 100% instead of 100vw to not cause horizontal overflow | |
children[3].style.setProperty("width", "100%"); | |
children[3].style.setProperty("height", "100vh"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment