Like a lot of people I saw Keith Clark's pure css implementation of parallax (Keith Clark's Tutorial) and really liked it a lot.
When trying to implement it, I get an inner vertical scrollbar around the overflowed vertical parallax content (not expected), as well as the outer vertical scrollbar that pertains to the static content that extends outside the vertical overflow of the screen (expected). I was wanting only one vertical scrollbar that controls the entire page (parallax group plus static content). When scrolling up/down with this, the parallax effect can be seen in the parallax group as well as moving static content in and out of view.
What changes do I need to make?
.parallax_group {
position: relative;
height: 100vh;
transform-style: preserve-3d;
}
.parallax {
perspective: 1px;
perspective-origin-x: 100%;
height: 100vh;
overflow-x: hidden;
overflow-y: auto;
}
.parallax_layer {
position: absolute;
transform-origin-x: 100%;
top: 0;
right: 0;
bottom: 0;
left: 0;
font-size: 200%;
}
.parallax_layer--base {
transform: translateZ(0) scale(1);
background-color: red;
}
.parallax_layer--back {
transform: translateZ(-1px) scale(2);
background-color: blue;
}
.parallax_layer--deep {
transform: translateZ(-2px) scale(3);
background-color: green;
}
.static_content {
height: 300px;
background-color: black;
}
<div class="parallax">
<div class="parallax_group">
<div class="parallax_layer parallax_layer--back">
<p>Back Layer</p>
</div>
<div class="parallax_layer parallax_layer--base">
<p>Base Layer</p>
</div>
<div class="parallax_layer parallax_layer--deep">
<p>Deep Layer</p>
</div>
</div>
</div>
<div class="static_content">
</div>