在滚动时制作一次动画

Animate on scroll once

本文关键字:一次 动画 滚动      更新时间:2023-09-26

我使用 fadethis js 插件并尝试在滚动时使动画只发生一次,不确定我哪里出错了

http://jsfiddle.net/robcleaton/pLdwdzpz/

.JS

$(document).ready(function() {
$(window).fadeThis();
});

简单的:

$(window).fadeThis({
    reverse:false
});

文档指定以下内容来设置插件:

<script>
$(document).ready(function() {
$(window).fadeThis({
    baseName:       "slide-",
    speed:          500, // <a href="http://www.jqueryscript.net/animation/">Animation</a> speed in milliseconds.
    easing:         "swing", // Animation easing.
    offset:         0, // <a href="http://www.jqueryscript.net/tags.php?/Scroll/">Scroll</a> offset, allowing to fire fading a little after or before the element appear.
    reverse:        true, // Make element disappear again when scrolled out, and fade again when scrolled in. 
    distance:       50, // Element distance to its emplacement, before animation.
    scrolledIn:     null, // Function to call when the element come in viewport. 
   scrolledOut:    null // Function to call when the element go out of the viewport. 
});
});
</script>
$(document).ready(function() {
    $(window).fadeThis({
        reverse: false;
    });
});

小提琴