简体   繁体   English

如何使用AOS向上滚动触发动画

[英]How to trigger animation on scroll up with AOS

I'm using AOS library (css & js) it helps me to create animation triggered everytime user scrolling down the page. 我正在使用AOS库(css和js),它可以帮助我创建每次用户向下滚动页面时触发的动画。 I have an issue that the top element of my page only run once because AOS only make it triggered when scroll down. 我有一个问题,就是页面的顶部元素只能运行一次,因为AOS仅在向下滚动时才触发它。 I want all my animation run evrytime user scrolling down and up. 我希望所有动画运行evrytime用户上下滚动。 How can I make it ? 我该怎么做? and this is a sample of my problem. 这是我的问题的一个例子。

JSFiddle 的jsfiddle

for look scrolling up do not give any effect please put 对于向上滚动不起作用,请放

<div class="alert kotak" data-aos="bounce"> 

in

<div class="wrapper">

tag 标签

您需要添加“ aos-item”的类名,这是一个示例,该示例在每次滚动通过它时都会对动画进行动画处理。

<div class="well hidden-sm hidden-xs aos-item" data-aos="zoom-out"  data-aos-anchor-placement="top-center">

I had the same question, i used attributes on the container: 我有同样的问题,我在容器上使用了属性:

 data-aos-mirror="true"

Or pass it as settings in the init object. 或将其作为设置传递给init对象。

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

});

Hope it helps for newcomers as me. 希望它对像我这样的新来者有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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