Experimenting with Parallax.js
Created
May 21, 2017 05:07
-
-
Save arcanoix/0220012e1bf26247dab3706af6d524e1 to your computer and use it in GitHub Desktop.
Under Construction Parallax Page
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
<main> | |
<ul id="scene" | |
data-friction-x="0.1" | |
data-friction-y="0.1" | |
data-scalar-x="25" | |
data-scalar-y="15" | |
data-limit-y="50" | |
class="scene"> | |
<li class="layer" data-depth="0.40"> | |
<div class="content"> | |
<h1 id="title">Site Launching Soon!</h1> | |
<p>We are working hard on our awesome new website. Stay Tuned!</p> | |
</div> | |
</li> | |
<li class="layer" data-depth="1.00"> | |
<div class="footer"></div> | |
</li> | |
<li class="layer" data-depth="0.65"> | |
<div class="cloud-back"> | |
<img src="http://res.cloudinary.com/jasonheecs/image/upload/v1480353347/construction/rocket_cloud_back.svg" alt="Site Launching Soon!" /> | |
</div> | |
</li> | |
<li class="layer" data-depth="0.70"> | |
<div class="rocket"> | |
<img src="http://res.cloudinary.com/jasonheecs/image/upload/v1480353347/construction/rocket.svg" alt="Site Launching Soon!" /> | |
</div> | |
</li> | |
<li class="layer" data-depth="0.75"> | |
<div class="cloud-front"> | |
<img src="http://res.cloudinary.com/jasonheecs/image/upload/v1480353347/construction/rocket_cloud_front.svg" alt="Site Launching Soon!" /> | |
</div> | |
</li> | |
</ul> | |
<div class="social">Follow Us: <a class="social__link" href="#"><img src="http://res.cloudinary.com/jasonheecs/image/upload/v1480353347/construction/facebook.svg" alt="Facebook" /></a></div> | |
</main> |
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
new Parallax(document.getElementById('scene')); |
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
<script src="https://cdnjs.cloudflare.com/ajax/libs/parallax/2.1.3/parallax.min.js"></script> |
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
$color-primary: #ff6213; | |
// Media Queries breakpoints | |
$small: 480px; | |
$medium: 768px; | |
$large: 992px; | |
$x-large: 1200px; | |
$min-height: 700px; | |
body { | |
background: url('http://res.cloudinary.com/jasonheecs/image/upload/v1480353347/construction/bg.jpg'); | |
font-family: 'Roboto', sans-serif; | |
} | |
main { | |
display: flex; | |
position: absolute; | |
left: 0; | |
flex-wrap: wrap; | |
width: 100%; | |
height: 100%; | |
text-transform: uppercase; | |
overflow: hidden; | |
} | |
img { | |
max-width: 100%; | |
height: auto; | |
} | |
.scene, | |
.layer { | |
display: block; | |
width: 100%; | |
height: 100%; | |
margin: 0; | |
padding: 0; | |
} | |
.scene { | |
position: relative; | |
min-height: 100vh; | |
overflow: hidden; | |
list-style-type: none; | |
} | |
.layer { | |
position: absolute; | |
} | |
.content { | |
position: relative; | |
padding: 20px; | |
font-size: 1rem; | |
@media screen and (min-width: $medium) { | |
top: 10%; | |
left: 15%; | |
} | |
@media screen and (min-width: $large) { | |
top: 18%; | |
} | |
} | |
.rocket, | |
.cloud-back, | |
.cloud-front { | |
position: relative; | |
width: auto; | |
text-align: right; | |
} | |
.cloud-front { | |
bottom: -85vh; | |
@media screen and (min-height: $min-height) { | |
bottom: calc(-98vh + 55px); | |
} | |
@media screen and (min-width: $medium) and (min-height: $min-height) { | |
bottom: calc(-85vh + 132px); | |
} | |
} | |
.cloud-back { | |
bottom: -75vh; | |
@media screen and (min-height: $min-height) { | |
bottom: calc(-98vh + 87px); | |
} | |
@media screen and (min-width: $medium) and (min-height: $min-height) { | |
bottom: calc(-85vh + 182px); | |
} | |
} | |
.rocket { | |
bottom: calc(-20vh); | |
@media screen and (min-height: $min-height) { | |
bottom: calc(-100vh + 330px); | |
} | |
@media screen and (min-width: $small) and (min-height: $min-height) { | |
bottom: calc(-95vh + 400px); | |
} | |
@media screen and (min-width: $medium) and (min-height: $min-height){ | |
bottom: calc(-85vh + 600px); | |
} | |
} | |
.footer { | |
position: absolute; | |
bottom: -5%; | |
left: -100%; | |
width: 300%; | |
height: 15vh; | |
background: $color-primary; | |
z-index: -1; | |
@media screen and (min-width: $small) { | |
height: 25vh; | |
} | |
@media screen and (min-width: $medium) { | |
bottom: -25vh; | |
height: 50vh; | |
} | |
@media screen and (min-width: $large) { | |
bottom: -15vh; | |
height: 50vh; | |
} | |
} | |
.social { | |
position: absolute; | |
top: 10px; | |
right: 5%; | |
color: #999; | |
text-transform: uppercase; | |
} | |
.social__link { | |
display: inline-block; | |
margin-left: 10px; | |
img { | |
vertical-align: middle; | |
} | |
} |
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
<link href="http://fonts.googleapis.com/css?family=Roboto:400,500,700" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment