简体   繁体   中英

How to use wow.js on scrollable container

i want to use wow.js on my website. I got a sidebar which needs to have the content inside a container with overflow-x: auto; . Because of this wow.js does not work.

Is it possible to define in wow.js the scrolling container?

My site looks like this:

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
    <script type="text/javascript" src="lib/js/wow.js"></script>
    <link rel="stylesheet" type="text/css" href="lib/css/animate.css">
    <script>
        $("document").ready(function() {
            new WOW().init();
        })
    </script>
    <style>
        body,html {
            margin: 0;
            padding: 0;
            height: 100%;
            width: 100%;
        }
        #container {
            height: 100%;
            width: 100%;
            position: relative;
        }
        #menu {
            position: absolute;
            width: 300px;
            left: -300px;
            background: red;
        }
        #content {
            position: absolute;
            width: 100%;
            height: 100%;
            background: green;
            overflow-x: auto;
        }
        .wow {
            background: yellow;
        }
    </style>
</head>
<body>
    <div id="container">
        <nav id="menu">
            <ul>
                <li>sidebar1</li>
                <li>sidebar2</li>
                <li>sidebar3</li>
            </ul>
        </nav>
        <div id="content">
            contentcontent<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>content<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>content<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>content<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><div class="wow bounce">text</div>content<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
        </div>
    </div>
</body>
<script>
</script>
</html>

Problem solved:

I've changed the Contentcontainer to a section and used this code to init wow.js

var wow = new WOW({ scrollContainer: "section"});
wow.init();

Thanks anyway

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM