简体   繁体   English

使用“aos”在第一个元素上触发 animation,但随后其他元素应触发而无需进一步滚动

[英]Use 'aos' to trigger animation on first element, but then the other elements should trigger without further scroll

I have multiple HTML elements over multiple rows that I want to animate as 'zoom in' in a sequence.我在多行上有多个 HTML 元素,我想在序列中将这些元素设置为“放大”。

When the user scrolls down, I want to animate the first item when it arrives in the viewport, and am currently using aos with the following:当用户向下滚动时,我想在第一个项目到达视口时为其设置动画,并且目前正在使用 aos 与以下内容:

<div class="col-lg-4 col-md-6 mb--30" data-aos="zoom-in" data-aos-duration="400" data-aos-once="true"
              data-aos-delay="50">

I then want to trigger the zoom in animation for the other 7 elements with a delay of 100 for each one, but I do not want this linked to the scroll.然后我想为其他 7 个元素触发 animation 的缩放,每个元素的延迟为 100,但我不希望这与滚动链接。 I want them all to trigger after the first item has been scrolled to, including the ones out of viewport at the time.我希望它们都在第一个项目被滚动到之后触发,包括当时不在视口中的项目。

Is this possible with aos?用aos可以吗?

You need to set the anchor property.您需要设置锚属性。

This will then use the anchor to trigger the animations然后这将使用锚点来触发动画

For example:例如:

<div id="parent">

    <div data-aos="fade-in" data-aos-anchor="#parent"></div>

</div>

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

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