Created
October 12, 2018 09:41
-
-
Save romainsassareu/a54abde855ff6259d914e29468ad54f8 to your computer and use it in GitHub Desktop.
Side-by-side Overlay
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
<style type="text/css"> | |
body { | |
overflow: hidden; | |
} | |
.notification-bar { | |
display: none; | |
} | |
.site-header { | |
position: fixed; | |
z-index: 10000; | |
} | |
#overlaynosto { | |
width: 100%; | |
position: fixed; | |
top: 0; | |
left: 0; | |
bottom: 0; | |
right: 0; | |
z-index: 9999; | |
} | |
#overlaynosto nosto-hero:after { | |
content: ""; | |
display: table; | |
clear: both; | |
} | |
#overlaynosto .nosto-hero-banner1 { | |
background: url("URL_#1") center center / cover no-repeat; | |
height: 100%; | |
width: 50%; | |
float: left; | |
cursor: pointer; | |
position: relative; | |
} | |
#overlaynosto .nosto-hero-banner2 { | |
background: url("URL_#2") center center / cover no-repeat; | |
height: 100%; | |
width: 50%; | |
float: right; | |
cursor: pointer; | |
position: relative; | |
} | |
#overlaynosto .nosto-hero-text { | |
font-size: 48px; | |
text-transform: uppercase; | |
color: white; | |
font-weight: 700; | |
text-align: center; | |
position: relative; | |
top: 50%; | |
transform: translateY(-50%); | |
line-height: 1.4; | |
z-index: 10001; | |
transition: all .3s ease-in-out; | |
-webkit-transition: all .3s ease-in-out; | |
-moz-transition: all .3s ease-in-out; | |
-ms-transition: all .3s ease-in-out; | |
} | |
#overlaynosto .nosto-hero-text span { | |
display: block; | |
} | |
#overlaynosto .nosto-hero-text span:first-child { | |
text-transform: none; | |
} | |
#overlaynosto .nosto-hero-mask { | |
width: 100%; | |
height: 100%; | |
background: black; | |
opacity: 0.3; | |
position: absolute; | |
top: 0; | |
left: 0; | |
transition: all .3s ease-in-out; | |
-webkit-transition: all .3s ease-in-out; | |
-moz-transition: all .3s ease-in-out; | |
-ms-transition: all .3s ease-in-out; | |
} | |
#overlaynosto .nosto-hero-banner1:hover > .nosto-hero-mask, | |
#overlaynosto .nosto-hero-banner2:hover > .nosto-hero-mask { | |
opacity: 0; | |
} | |
#overlaynosto .nosto-hero-banner1:hover > .nosto-hero-text, | |
#overlaynosto .nosto-hero-banner2:hover > .nosto-hero-text { | |
transform: translateY(-50%) scale(1.1); | |
-webkit-transform: translateY(-50%) scale(1.1); | |
-moz-transform: translateY(-50%) scale(1.1); | |
-ms-transform: translateY(-50%) scale(1.1); | |
} | |
@media (max-width: 749px) { | |
#overlaynosto .nosto-hero-banner1, | |
#overlaynosto .nosto-hero-banner2 { | |
float: none; | |
width: 100%; | |
height: 50%; | |
} | |
#overlaynosto .nosto-hero-text { | |
font-size: 28px; | |
} | |
} | |
</style> | |
<div class="nosto-hero-banner1"> | |
<div class="nosto-hero-text"> | |
<span>WOMAN</span> | |
</div> | |
<div class="nosto-hero-mask"></div> | |
</div> | |
<div class="nosto-hero-banner2"> | |
<div class="nosto-hero-text"> | |
<span>MAN</span> | |
</div> | |
<div class="nosto-hero-mask"></div> | |
</div> | |
<script type="text/javascript"> | |
var win = _targetWindow; | |
win.document.querySelector(".nosto-hero-banner1").addEventListener("click", function () { | |
new Promise(function(resolve, reject) { | |
win.nostojs(function(api){api.addSegmentCodeToVisit("Woman")}); | |
resolve(); | |
}) | |
.then(function() { | |
win.nostojs(function(api) { | |
api.loadRecommendations(); | |
win.location.reload(); | |
}); | |
}); | |
}); | |
win.document.querySelector(".nosto-hero-banner2").addEventListener("click", function () { | |
new Promise(function(resolve, reject) { | |
win.nostojs(function(api){api.addSegmentCodeToVisit("Man")}); | |
resolve(); | |
}) | |
.then(function() { | |
win.nostojs(function(api) { | |
api.loadRecommendations(); | |
win.location.reload(); | |
}); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment