Wow.js repeat animation every time you scroll up or down

前端 未结 3 1895
后悔当初
后悔当初 2021-02-04 19:48

I\'m pretty new with Jquery. I would like that my animations with Wow.js could run more than once time. For instance: i scroll to the bottom of my page and see all the animation

3条回答
  •  星月不相逢
    2021-02-04 20:44

    If a user wants to repeat the animation on both the events i.e.

    • onScrollUp
    • onScrollDown

    then this will be a good solution for it:

    First create an addBox function, it will help to push new elements into the WOW boxes array.

    WOW.prototype.addBox = function(element){
        this.boxes.push(element);
    };
    

    Then use jQuery and scrollspy plugin that helps to detect which element is out of the view and then push WOW as:

    $('.wow').on('scrollSpy:exit',function(){
        var element = $(this);
        element.css({
            'visibility' : 'hidden',
            'animation-name' : 'none'
        }).removeClass('animated');
        wow.addBox(this);
    });
    

    Solution Courtesy: ugurerkan

提交回复
热议问题