小春网

 找回密码
 注册账号
查看: 620|回复: 2
收起左侧

[IT 交流] 动画效果显示文字标题

[复制链接]
发表于 2013-12-17 18:37:50 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册账号

x
animate.gif


  1.         <div class="container">
  2.                 <div class="row">
  3.                         <div class="col-lg-12">
  4.                                 <div class="jumbotron">
  5.                                         <h1><span>Hello</span> <span>World</span></h1>
  6.                                         <p>This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.</p>
  7.                                         <p><a class="btn btn-primary btn-lg" role="button">Learn more</a></p>
  8.                                 </div>
  9.                         </div>
  10.                 </div>
  11.         </div>
复制代码

  1.         <script>
  2.         $(function() {
  3.                 $('span').hide();
  4.                 $('p').hide();

  5.                 animate_show('span:eq(0)', 'slideInLeft');
  6.                 animate_delay('span:eq(0)', 'span:eq(1)', 'slideInRight');
  7.                 animate_delay('span:eq(1)', 'p:eq(0)', 'fadeInUp');
  8.                 animate_delay('p:eq(0)', 'p:eq(1)', 'rotateIn');

  9.                 /**
  10.                  * 使用一个效果来显示一个元素
  11.                  * @param  {string} element 元素
  12.                  * @param  {string} animate animate.css的效果
  13.                  * @return {void}         
  14.                  */
  15.                 function animate_show(element, animate) {
  16.                         $(element).show().addClass('animated ' + animate);
  17.                 }

  18.                 /**
  19.                  * 顺序显示第二个元素的效果
  20.                  * @param  {string} element1 等待结束的元素
  21.                  * @param  {string} element2 接下来要显示的元素
  22.                  * @param  {string} animate  animate.css的效果
  23.                  * @return {void}         
  24.                  */
  25.                 function animate_delay(element1, element2, animate) {
  26.                         $(element1).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function() {
  27.                                 animate_show(element2, animate);
  28.                         });
  29.                 }
  30.         });
  31.         </script>
复制代码



评分

参与人数 1 +44 收起 理由
憨吃迷糊睡 + 44 赞一个

查看全部评分

发表于 2013-12-17 21:05:50 | 显示全部楼层
你这是jquery吗?不用引用库文件吗?
回复

使用道具 举报

 楼主| 发表于 2013-12-21 16:10:55 | 显示全部楼层
naturally 发表于 2013-12-17 21:05
你这是jquery吗?不用引用库文件吗?

当然是jquery和animate.css
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号

本版积分规则

小春网
常务客服微信
微信订阅号
手机客户端
扫一扫,查看更方便! 快速回复 返回顶部 返回列表