wow.js happens on page load and not on scroll

后端 未结 9 1051
孤独总比滥情好
孤独总比滥情好 2020-12-16 12:32

I\'m using wow.js, and it works fine, except the animations all happen immediately after the page load, and not when they are scrolled to. I followed the docs, but can\'t fi

相关标签:
9条回答
  • 2020-12-16 12:52

    I had a similar problem today, because I was using a fixed navigation bar width a height of 160px the content was loaded before I could see it.

    I solved it by adding an offset in the WOW initialization :

    new WOW({offset: 160 }).init()
    

    Hope it could help.

    0 讨论(0)
  • 2020-12-16 12:54

    For bouncing on the answer proposed by DesignofKA, I had the same issue due to fixed height property in a wrapping div.

    I simply init wow during window.onload event to solve the wow problem.

    My code is:

    $(window).load(function() {
        var wow = new WOW({
            boxClass: 'wow',
            animateClass: 'animated',
            offset: 0,
            mobile: true,
            live: true
        });
        wow.init();
    });
    
    0 讨论(0)
  • 2020-12-16 12:55

    Late response however this still may help others.

    If WOW.js is still not working after adding the latest version or adding <!DOCTYPE html> the problem may be due to a conflict in the scroll (or more specifically the viewport).

    In my case, the problem was caused within my CSS when using the following:

    html, body {height:100%; width:100%; overflow:hidden}

    By removing the height and width properly, I was able to solve the problem as Wow.js was then able to notice when the element came into the viewport and change the elements visibility.

    0 讨论(0)
提交回复
热议问题