Parallax effect - make section appear behind previous section without moving content

Viewed 225

So what I currently have is a parallax effect that works fine, but I can't figure out how to make one section "slide up" and reveal the next section, making it look like a smooth section transition. Currently my content on the second section just keeps scrolling down until it's in its place, and I can't seem to make it appear behind the first section. I currently have this: https://jsfiddle.net/165pw4ks/3/.

index.html:

<div class="parallax-wrapper">
    <div class="frame-top"></div>
    <section class="parallax-section part1">
        <div class="frame-bottom"></div>
        <div class="part1-sticky-container">
            <div class="part1-sticky">

            </div>
        </div>
    </section>

    <section class="parallax-section part2">
        <div class="part2-content">
            <h1 class="part2-text">
                Some text here
            </h1>
        </div>
    </section>
</div>

style.css:

body {
    margin: 0;
}

.parallax-wrapper {
    top: 100vh;
}

.parallax-section {
    position: relative;
}

.part1 {
    background: url("https://place-hold.it/1920x1080") no-repeat;
    width: 100vw;
    height: 100vh;
    background-size: cover;

    z-index: 4;
}

.frame-bottom {
    position: sticky;
    z-index: 100;
    top: calc(100vh - 40px);
    height: 40px;
    width: 100%;
    background-color: #111;
}

.part2 {
    margin: 0;

    background: url("https://place-hold.it/1920x1080") no-repeat;
    background-size: 100vw;
    width: 100vw;
    height: 100vh;

    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;

    z-index: 1;
}

.part2-content {
    position: sticky;
    width: 30rem;
    height: 5rem;
    z-index: 1;
    background-attachment: scroll;
    background-color: transparent;
    margin-left: calc(50% - 15rem);
    top: calc(50% - 2.5rem);
}

.part2-text {
    margin: 0;
    color: white;
    font-size: 32px;
    text-align: center;
}

What I am attempting to make is something like on this picture: Illustration of what I am trying to make

Any help would be appreciated.

0 Answers
Related