首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >动画到单个滚动部分

动画到单个滚动部分
EN

Stack Overflow用户
提问于 2016-02-08 10:46:18
回答 1查看 80关注 0票数 0

检查这里的完整代码,http://codepen.io/anon/pen/jWQOxa

在上面的代码页中,我尝试将动画应用于不同的滚动部分。但是当我打开应用程序时,所有单独的部分都同时执行动画。它不会等到它真正进入用户的视图。因此,我想应用相同的动画,并使它只执行当它进入用户的视图。请告诉我如何做到这一点。提前感谢!

HTML5:

代码语言:javascript
复制
   <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:

代码语言:javascript
复制
  .aboutanimate,.featuresanimate,.teamanimate,.contactanimate {
    animation-duration: 1s;
    animation-name: slidein;
}

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

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-02-11 09:49:25

我有快速的黑客解决方案,而不是这么长的解决方案。我用过animate.css和wow.js。这就像预期的一样。您可以在这里看到一个例子:http://codepen.io/anon/pen/obJqqm

代码语言:javascript
复制
      <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>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35267711

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档