我正在使用 AOS 库(css 和 js)它帮助我创建每次用户向下滚动页面时触发的动画。我有一个问题,我的页面的顶部元素只运行一次,因为 AOS 只在向下滚动时触发它。我希望我所有的动画运行 evrytime 用户上下滚动。我怎样才能做到? 这是我的问题的示例。
为了看起来向上滚动没有任何效果请放
<div class="alert kotak" data-aos="bounce">
在
<div class="wrapper">
标签
最佳答案
我有同样的问题,我在容器上使用了属性:
data-aos-mirror="true"
或者将其作为设置传递给初始化对象。
AOS.init();
// You can also pass an optional settings object
// below listed default settings
AOS.init({
// Global settings:
debounceDelay: 50, // the delay on debounce used while resizing window (advanced)
// Settings that can be overridden on per-element basis, by `data-aos-*` attributes:
once: false, // whether animation should happen only once - while scrolling down
mirror: true, // whether elements should animate out while scrolling past them
});
希望对我这样的新手有所帮助。
关于javascript - 如何在使用 AOS 向上滚动时触发动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41604911/