gpt4 book ai didi

javascript - 单个滚动部分的动画

转载 作者:行者123 更新时间:2023-11-28 06:26:16 25 4
gpt4 key购买 nike

在此处查看完整代码 http://codepen.io/anon/pen/jWQOxa

在上面的 codepen 中,我试图将动画应用于不同的滚动部分。但是当我打开应用程序时,所有单独的部分都会同时执行动画。它不会等到它真正进入用户的视野。所以我想应用相同的动画并使其仅在进入用户 View 时执行。请让我知道我怎样才能做到这一点。提前致谢!

HTML5:

   <div class="navbar-fixed">
<nav>
<div class="nav-wrapper light-blue darken-4">
<a href="#" class="brand-logo">hallo</a>
<a href="#" data-activates="mobile-demo" class="button-collapse"><i class="material-icons">menu</i></a>
<ul class="right hide-on-med-and-down section table-of-contents">
<li><a href="#about" style="color:#">About Us</a></li>
<li><a href="#features" style="color:">Features</a></li>
<li><a href="#team" style="color:">Our Team</a></li>
<li><a href="#contact" style="color:">Contact Us</a></li>
</ul>

<div class="aboutanimate" id="about">
<h1>Watch me move-1</h1>
<p>
This example shows how to use CSS animations to make <code>H1</code>
elements move across the page.
</p>
<p>In addition, we output some text each time an animation event fires,so you can see them in action.</p>
</div>

<div class="featuresanimate" id="features">
<h1>Watch me move-2</h1>
<p>This example shows how to use CSS animations to make <code>H1</code>elements move across the page.</p>
<p>In addition, we output some text each time an animation event fires,so you can see them in action.</p>
</div>

CSS:

  .aboutanimate,.featuresanimate,.teamanimate,.contactanimate {
animation-duration: 1s;
animation-name: slidein;
}

@keyframes slidein {
from {
margin-left: 100%;
width: 300%;
}
to {
margin-left: 0%;
width: 100%;
}
}

最佳答案

我有快速破解解决方案而不是这么长的解决方案。我用过 animate.css 和 wow.js。这正如预期的那样有效。 你可以在这里看到一个例子: http://codepen.io/anon/pen/obJqqm

      <div class="row" >
<div class="aboutanimate">
<div id="about" class="section scrollspy">
<div class="container">
<h2 class="wow animated shake" style="text-decoration:underline;text-align:center;font-weight:bold;font-family:Comic Sans MS">About Us</h2><br><br>
<div class="quot animated shake">
<h5 style="color:#446CB3;padding-top:30px;text-decoration:underline;font-weight:bold;font-size:35px;font-family:Comic Sans MS">Vision</h5>
<p id="vision">"Lorem ipsem Lorem ipsemLorem ipsemLorem ipsemLorem ipsemLorem ipsem</p>
<h5 style="color:#446CB3;text-decoration:underline;font-weight:bold;font-size:35px;font-family:Comic Sans MS">Mission</h5>
<p id="vision">"Lorem ipsemLorem ipsemLorem ipsemLorem ipsemLorem ipsemLorem ipsem"</p>
<h5 style="color:#446CB3;text-decoration:underline;font-weight:bold;font-size:35px;font-family:Comic Sans MS">Objectives</h5>
<p id="vision">"Lorem ipsemLorem ipsemLorem ipsemLorem ipsemLorem ipsemLorem ipsemLorem ipsem"</p><br><br><br>
</div>
</div>
</div>
</div><br><br>

关于javascript - 单个滚动部分的动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35267711/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com