How to use Fullpage.js with Scrollr.js at the same time

I have a project which is using Fulpage.js and I want just one of the sections of this project to be scrolled Horizontally.

So I added Scrollr.js, but the problem is that, it does not work.

Here is a my code:

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="./fullpage.min.css">
    <title>Fullpage Animation</title>
    <style>
        body{
            margin:0;
            padding:0;
            font-family: sans-serif;
        }
        .temps{
            position:fixed;
            top:0;
            left:0;
            width:100%;
            display:flex;
        }
        .nemoone{
            min-width:100%;
            height:auto;
            display:flex;
        }
        .nemoone .storyBx{
            padding:100px 60px;
        }
        .nemoone .storyBx h2{
            margin:0 0 20px;
            padding:0;
            font-size:48px;
        }
        .nemoone .storyBx p{
            margin:0;
            padding:0;
            font-size:18px;
            text-align: justify;
        }
    </style>
</head>
<body>
    <div id="fullpage">
        <section class="section s1">
            <h1>Other</h1> 
            <div class="temps" data-0="transform:translateX(0%)" data-4000="transform:translateX(-300%)">
                <div class="nemoone">
                    <div class="imgBx">
                        <!-- <img src="img2.jpg"> -->
                    </div>
                    <div class="storyBx">
                        <h2>Horizontal Scrolling</h2>
                        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
                        tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
                        quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
                        consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
                        cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
                        proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<br><br>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
                        tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
                        quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
                        consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
                        cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
                        proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<br><br>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
                        tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
                        quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
                        consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
                        cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
                        proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
                </div>
                <div class="nemoone">>
                    <div class="imgBx">
                        <!-- <img src="img3.jpg"> -->
                    </div>
                    <div class="storyBx">
                        <h2>Horizontal Scrolling</h2>
                        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
                        tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
                        quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
                        consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
                        cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
                        proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<br><br>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
                        tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
                        quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
                        consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
                        cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
                        proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<br><br>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
                        tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
                        quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
                        consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
                        cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
                        proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
                    </div>
                </div>
                <div class="nemoone">>
                    <div class="imgBx">
                        <!-- <img src="img4.jpg"> -->
                    </div>
                    <div class="storyBx">
                        <h2>Horizontal Scrolling</h2>
                        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
                        tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
                        quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
                        consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
                        cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
                        proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<br><br>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
                        tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
                        quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
                        consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
                        cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
                        proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<br><br>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
                        tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
                        quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
                        consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
                        cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
                        proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
                    </div>
                </div>
                <div class="nemoone">>
                    <div class="imgBx">
                        <!-- <img src="img5.jpg"> -->
                    </div>
                    <div class="storyBx">
                        <h2>Horizontal Scrolling</h2>
                        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
                        tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
                        quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
                        consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
                        cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
                        proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<br><br>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
                        tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
                        quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
                        consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
                        cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
                        proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<br><br>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
                        tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
                        quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
                        consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
                        cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
                        proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
                    </div>
                </div>
            </div>
        </section>
        <section class="section s2">
            <h1>Another Section</h1>
        </section>
    </div>

    <script src="./fullpage.min.js"></script>
    <script src="./skrollr.js"></script>
    <script>
        new fullpage("#fullpage", {
            autoScrolling: true,
            navigation: true,
            onLeave: (origin, destination, direction) => {
                const section = destination.item;
                const title = section.querySelector("h1");
                const tl = new TimelineMax({delay: 0.5});
                tl.fromTo(title, 0.5, {y: "50", opacity: 0}, {y:0, opacity:1});

                if(destination.index === 1){
                    const description = document.querySelector(".description");

                    tl.fromTo(description, 0.5, {y: "50", opacity: 0}, {y:0, opacity:1})
                }
            }
        });
        skrollr.init();
    </script>
</body>
</html>

So my question is how can I make these two Plugins work at the same time together ? Is it possible or not ? If yes, then how ?

I would really appreciate any idea from you guys, thanks in advance.

Alvaro's Answer Update:

Just like Alvaro says, in order to use these two plugins, I have to use:

new fullpage('#fullpage', {
    scrollBar: true
});

So when I do this, the horizontal scrolling works, but now the problem is, horizontal scrolling and fullpage.js vertical scrolling, works at the same time together!

In fact, horizontal scrolling at this section must be finished and after that, the other sections can come afterwards.



Read more here: https://stackoverflow.com/questions/64256626/how-to-use-fullpage-js-with-scrollr-js-at-the-same-time

Content Attribution

This content was originally published by POOYAA at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: