Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id="parallax_banner" class="parallax_main">
            <section id="parallax-section-1" class="section active">
                <div class="section-content">
                    <div class="title-1">Environmental Protection is</div>
                    <div class="title-2">Our commitment to the Eatch</div>
                    <a href="#" class="button">Read more</a>
                </div>
                <img src="https://tools.digishot.name/freelancer/modernsolid/img/banner01-parts.png" alt="" class="picture">
                <div class="section-bg" style="background-image: url(https://tools.digishot.name/freelancer/modernsolid/img/banner01.jpg)"></div>
                <div class="scroll-down-mark">Scroll</div>
            </section>

            <section id="parallax-section-2" class="section">
                <div class="section-content">
                    <div class="title-1">Professionality Hospital Arm</div>
                    <div class="title-2">Improving healthcare efficiency</div>
                    <a href="#" class="button">Read more</a>
                </div>
                <img src="https://tools.digishot.name/freelancer/modernsolid/img/banner02-parts.png" alt="" class="picture">
                <div class="section-bg" style="background-image: url(https://tools.digishot.name/freelancer/modernsolid/img/banner02.jpg)"></div>
            </section>

            <section id="parallax-section-3" class="section">
                <div class="section-content">
                    <div class="title-1">Free Up Your Workspace</div>
                    <div class="title-2">For Better Working Comfort and Productivity</div>
                    <a href="#" class="button">Read more</a>
                </div>
                <img src="https://tools.digishot.name/freelancer/modernsolid/img/banner03-parts.png" alt="" class="picture">
                <div class="section-bg" style="background-image: url(https://tools.digishot.name/freelancer/modernsolid/img/banner03.jpg)"></div>
            </section>

            <section id="parallax-section-4" class="section">
                <div class="section-content">
                    <div class="title-1">Ergonomic Design Integrated into Life</div>
                    <div class="title-2">Cosy.user-friendly.stylish</div>
                    <a href="#" class="button">Read more</a>
                </div>
                <img src="https://tools.digishot.name/freelancer/modernsolid/img/banner04-parts.png" alt="" class="picture">
                <div class="section-bg" style="background-image: url(https://tools.digishot.name/freelancer/modernsolid/img/banner04.jpg)"></div>
            </section>

            <section id="parallax-section-5" class="section">
                <div class="section-content">
                    <div class="title-1">Your Most Valued Partner</div>
                    <div class="title-2">Designing And Manufacturing Mounting Solutions</div>
                    <a href="#" class="button">Read more</a>
                </div>
                <img src="https://tools.digishot.name/freelancer/modernsolid/img/banner05-parts.png" alt="" class="picture">
                <div class="section-bg" style="background-image: url(https://tools.digishot.name/freelancer/modernsolid/img/banner05.jpg)"></div>
            </section>

            <section class="section --scroll">
                <div class="section-content">
                    <div>begin</div>
                    <div style="height:2000px"></div>
                    <div>end</div>
                    <div class="section-bg"></div>
                    <div class="picture"></div>
            </section>
        </div>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;400;700&display=swap');

$default-width: 1920px;
$tv-width: 1440px;
$desktop-width: 1200px;
$tablet-width-lg: 991px;
$tablet-width: 768px;
$mobile-width: 600px;

@mixin default {
    @media (min-width: #{$default-width}) {
      @content;
    }
  }

@mixin tv {
    @media (max-width: #{$tv-width}) {
      @content;
    }
  }

@mixin desktop {
  @media (max-width: #{$desktop-width}) {
    @content;
  }
}

@mixin tablet-lg {
  @media (max-width: #{$tablet-width-lg}) {
    @content;
  }
}

@mixin tablet {
    @media (max-width: #{$tablet-width}) {
      @content;
    }
  }

@mixin mobile {
    @media (max-width: #{$mobile-width}) {
      @content;
    }
  }

body{
    top:0;
    overflow:hidden;
    z-index:1;
    background:#fff;
    font-family: Poppins;
}

.parallax_main {
    position: relative;
    height: 100vh;
    width: 100%;
    overflow: hidden;
    z-index: 1;
}

.section {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    color: white;
    display: flex;
    flex-flow: column nowrap;
    justify-content: center;
    align-items: center;
    z-index: 4;
    will-change: transform;
    overflow: hidden;

    &.active {
        z-index: 5;
    }
}

.section-content {
    z-index: 4;
    color: #393B3A;
    padding: 10px;
    position: absolute;
    left: 2%;

    .title-1 {
        font-size: 2.2vw;
        font-weight: 700;
        line-height: 2.5vw;
    }

    .title-2 {
        font-size: 1.7vw;
        font-weight: 400;
    }

    .button {
        margin-top: 20px;
        display: block;
        padding: 10px 15px;
        width: 160px;
        color: #fff;
        background: #3A3A3A;
        font-size: 16px;
        transition: 1s;

        &:hover {
            text-decoration: none;
            background: #5A5A5A;
        }
    }
}

.section-bg {
    position: absolute;
    z-index: 1;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    will-change: transform;
    background-position: right bottom;
    background-size: cover;
    background-repeat: no-repeat;

    @include tv{
        background-size: auto;
    }
}

.picture {
    position: absolute;
    z-index: 2;
    top: 15%;
    right: 0;
    display: block;
    transform: scale(1);
    max-width: none;

    @include tv{
        transform: scale(0.9);
    }

    @include desktop{
        transform: scale(0.8);
    }
}

.--scroll {
    overflow: auto;
    display: block;
    width: 100%;
    .section-content {
        width:100%;
        left:0;
    }
}

#parallax-section-1 {
    .scroll-down-mark{
        position:absolute;
        bottom:0;
        right:25px;
        background-color: #004EA1;
        color:#fff;
        z-index:2;
        font-size:14px;
        font-weight: 200;
        text-align: center;
        width: 60px;
        padding-top:70px;
        padding-bottom:20px;
    }

    .section-content {
        color: #fff;

        @include tv{
            top:15%;
        }

        @include desktop{
            top:15%;
        }

        @include tablet-lg {
           top:10%;
        }

        .title-1{
            @include tv{
                font-size:4vw;
                line-height:4vw;
            }

            @include desktop{
                font-size:4vw;
                line-height:4vw;
            }

            @include tablet-lg {
                font-size:6vw;
                line-height:6vw;
            }
        }
        .title-2{
            @include desktop{
                font-size:3vw;
                line-height:3vw;
            }

            @include tablet-lg {
                font-size:5vw;
                line-height:6vw;
            }
        }
    }

    .picture{
        @include tv{
            top:auto;
            bottom: -10%;
            right: -7%;
        }

        @include desktop{
            right: -15%;
        }

        @include tablet-lg{
            bottom:-5%;
            right:-5%;
        }

        @include mobile{
            width:100%;
            transform: scale(1);
            right:0;
            bottom:0;
        }
    }
}

#parallax-section-2 {
    .section-content {
        left: 2%;
        top: 36%;

        @include tv{
            bottom:2%;
            top:auto;
        }

        .title-1 {
            @include tv{
                font-size:4vw;
                line-height:4vw;
            }

            @include desktop{
                font-size:4vw;
                line-height:4vw;
            }

            @include tablet-lg {
                font-size:6vw;
                line-height:6vw;
            }
        }

        .title-2 {
            @include desktop{
                font-size:3vw;
                line-height:3vw;
            }

            @include tablet-lg {
                font-size:5vw;
                line-height:6vw;
            }
        }
    }

    .picture {
        top: 0;
        right: -8%;

        @include tv{
            transform: scale(0.8);
            top: -12%;
            right: -18%;
        }

        @include tablet{
            left:0;
            right:auto;
        }

        @include mobile{
            transform:scale(0.7);
            left: -13%;
            top: -25%;
        }
    }
}

#parallax-section-3 {
    .section-content {
        top: 38%;

        @include tv{
            top: auto;
            bottom: 10%;
        }

        .title-1 {
            @include tv{
                font-size:4vw;
                line-height:4vw;
            }

            @include desktop{
                font-size:4vw;
                line-height:4vw;
            }

            @include tablet-lg {
                font-size:6vw;
                line-height:6vw;
            }
        }

        .title-2 {
            width: 70%;
            line-height: 2vw;
            @include desktop{
                font-size:3vw;
                line-height:3vw;
            }

            @include tablet-lg {
                font-size:5vw;
                line-height:5vw;
            }
        }
    }

    .picture {
        top: auto;
        bottom: 3%;
        right: -3%;

        @include tv{
            bottom: -1%;
            right: -7%;
        }

        @include desktop {
            bottom: -4%;
            right: -15%;
        }

        @include mobile{
            bottom: -4%;
            right: -25%;
        }
    }
}

#parallax-section-4 {
    .section-content {
        color: #fff;
        left: 2%;
        top: 35%;

        @include tv{
            top: auto;
            bottom: 10%;
            text-shadow: 0 0 5px rgba(0,0,0,0.5);
        }
        
        @include desktop{
            top: auto;
            bottom: 30%;
            width: 80%;
            left: 37%;
        }

        @include tablet-lg{
            bottom: 25%;
            left: 50%;
        }

        @include tablet{
            bottom: auto;
            top:10%;
        }

        @include mobile{
            bottom: 21%;
            top: auto;
        }

        .title-1 {
            width: 60%;
            @include tv{
                font-size:4vw;
                line-height:4vw;
            }

            @include desktop{
                font-size:4vw;
                line-height:4vw;
            }

            @include tablet-lg {
                font-size:6vw;
                line-height:6vw;
            }
        }

        .title-2 {
            width: 60%;
            @include desktop{
                font-size:3vw;
                line-height:3vw;
            }

            @include tablet-lg {
                font-size:5vw;
                line-height: 5vw;
            }
        }
    }

    .picture {
        bottom: 0%;
        right: 21%;
        top: auto;

        @include desktop{
            right: 35%;
        }

        @include tablet-lg{
            right: 40%;
        }

        @include tablet{
            right: 28%;
            bottom: -11%;
        }
        @include mobile{
            transform: scale(0.7);
            right: auto;
            bottom: auto;
        }
    }

    .section-bg{
        @include mobile{
            background-position: bottom left;
        }
    }
}

#parallax-section-5 {
    .section-content {
        left: 2%;
        top: 35%;
        .title-1 {
            @include tv{
                font-size:4vw;
                line-height:4vw;
            }

            @include desktop{
                font-size:4vw;
                line-height:4vw;
            }

            @include tablet-lg {
                font-size:6vw;
                line-height:6vw;
            }
        }

        .title-2 {
            @include desktop{
                font-size:3vw;
                line-height:3vw;
            }

            @include tablet-lg {
                font-size:5vw;
                line-height:6vw;
            }
        }
    }

    .picture {
        top: auto;
        right: auto;
        bottom: -5%;
        left: 20%;

        @include desktop{
            bottom: -8%;
        }
    }

    .section-bg {
        background-position: bottom right;
        background-size: cover;
    }
}
              
            
!

JS

              
                $(function(){
    let _ = window._;

    const sections = document.querySelectorAll(".section");
    const sectionsBG = document.querySelectorAll(".section-bg");
    const sectionsPicture = document.querySelectorAll(".picture");
    const duration = 0.8;
    const ease = "power4.inOut";
    const amt = $(".section").length - 1;

    let scrolling;

    let prevSection = -1;
    let activeSection = 0;
    let nextSection = 1;

    var startCoords = {}, endCoords = {};
    var touchstartY, touchendY = 0;
    $('.parallax_main').on('touchstart mousedown', function(event){
        event.preventDefault();
        startCoords = event.originalEvent.targetTouches[0];
        touchstartY = startCoords.pageY;
    })
    .on('touchstart touchmove mousemove', function(event){
        event.preventDefault();
        endCoords = event.originalEvent.targetTouches[0];
        //console.log(endCoords);
    })
    .on('mouseup mouseleave touchend', function(e){
        touchendY = endCoords.pageY;
        // console.log('start: '+touchstartY);
        // console.log('end: '+touchendY);
        handleGesure();
    });

    function handleGesure() {
        var swiped = 'swiped: ';
        if (touchendY < touchstartY) {
            //console.log(swiped + 'down!');
            if (activeSection < amt) slidesDown();
        }
        if (touchendY > touchstartY) {
            //console.log(swiped + 'up!');
            if (activeSection > 0) slidesUp();
        }
    }

    // Init Slides
    const initSlides = () => {
    sections.forEach((section, index) => {
        if (index != activeSection) {
            gsap.set(section, {
                yPercent: 100
            });
            gsap.set(sectionsBG[index], {
                yPercent: -50
            });
            gsap.set(sectionsPicture[index], {
                yPercent: 80
            });
        }
    });
    };

    // Update Slides
    const updateSlides = () => {
    sections.forEach((section, index) => {
        if (index == activeSection) {
        section.classList.add("active");
        } else {
        section.classList.remove("active");
        }
    });
    };

    // SCROLL UP FUNCTIONALITY
    const slidesUp = () => {
    // Current Slide
    gsap.to(sections[activeSection], {
        yPercent: 100,
        duration: duration,
        ease: ease
    });
    gsap.to(sectionsBG[activeSection], {
        yPercent: -50,
        duration: duration,
        ease: ease
    });
    gsap.to(sectionsPicture[activeSection], {
        yPercent: 80,
        duration: duration,
        ease: ease
    });
    // Previous Slide
    gsap.to(sections[prevSection], {
        yPercent: 0,
        duration: duration,
        ease: ease
    });
    gsap.to(sectionsBG[prevSection], {
        yPercent: 0,
        duration: duration,
        ease: ease
    });
    gsap.to(sectionsPicture[prevSection], {
        yPercent: 0,
        duration: duration,
        ease: ease
    });
    // Set new vars
    prevSection--;
    activeSection--;
    nextSection--;
    };

    // SCROLL DOWN FUNCTIONALITY
    const slidesDown = () => {
    // Current Slide
    gsap.to(sections[activeSection], {
        yPercent: -100,
        duration: duration,
        ease: ease
    });
    gsap.to(sectionsBG[activeSection], {
        yPercent: 50,
        duration: duration,
        ease: ease
    });
    gsap.to(sectionsPicture[activeSection], {
        yPercent: -80,
        duration: duration,
        ease: ease
    });
    // Next Slide
    gsap.to(sections[nextSection], {
        yPercent: 0,
        duration: duration,
        ease: ease
    });
    gsap.to(sectionsBG[nextSection], {
        yPercent: 0,
        duration: duration,
        ease: ease
    });
    gsap.to(sectionsPicture[nextSection], {
        yPercent: 0,
        duration: duration,
        ease: ease
    });
    // Set new vars
    prevSection++;
    activeSection++;
    nextSection++;
    };

    // Update index on scroll
    const handleWheel = (e) => {
    // UP
    if (e.deltaY < -1) {
        if (activeSection == 0) {
        return;
        } else if (activeSection == sections.length - 1) {
        if (sections[activeSection].scrollTop == 0) {
            slidesUp();
        }
        } else {
        slidesUp();
        }
    }
    // DOWN
    else if (e.deltaY > 1) {
        if (activeSection == sections.length - 1) {
        return;
        }
        slidesDown();
    }
    
    updateSlides();
    };


    // ON SCROLL
    const throttleWheel = _.throttle(handleWheel, 750, { trailing: false, leading: true });
    window.addEventListener("wheel", throttleWheel);

    // ON ARROW KEY
    const handleKeyUp = (e) => {
    if (e.key == "ArrowUp" && activeSection != 0) {
        slidesUp();
    } else if (e.key == "ArrowDown" && activeSection != sections.length - 1) {
        slidesDown();
    }
    updateSlides();
    };

    window.addEventListener(
    "keyup",
    _.throttle(handleKeyUp, 750, { trailing: false, leading: true })
    );

    initSlides();
});
              
            
!
999px

Console