首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >为文本创建淡入淡出效果(包含示例)

为文本创建淡入淡出效果(包含示例)
EN

Stack Overflow用户
提问于 2016-05-27 05:50:22
回答 2查看 109关注 0票数 0

很抱歉发了这么短的帖子,但我需要一些帮助来创造这个网站上显示的效果:

http://joelfilipe.com/

基本上,我知道你可以用jQuery做一个"fadeIn“,但我不确定如何在网站上实现3d效果,因为它看起来像是降落在页面上,我试图深入研究代码和视图,但我相当困惑。任何帮助或建议都将不胜感激。谢谢。

EN

回答 2

Stack Overflow用户

发布于 2016-05-27 06:03:13

这不需要使用javascript,只需使用CSS即可完成,如下所示。

代码语言:javascript
复制
@import url(http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300);

body {padding: 0; margin: 0; background-color: #333;}

.container {position: fixed; top: 25%; left: 25%;}

/* make keyframes that tell the start state and the end state of our object */
@-webkit-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@-moz-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

.fade-in {
  opacity:0;  /* make things invisible upon start */
  -webkit-animation:fadeIn ease-in 1;  /* call our keyframe named fadeIn, use animattion ease-in and repeat it only 1 time */
  -moz-animation:fadeIn ease-in 1;
  animation:fadeIn ease-in 1;

  -webkit-animation-fill-mode:forwards;  /* this makes sure that after animation is done we remain at the last keyframe value (opacity: 1)*/
  -moz-animation-fill-mode:forwards;
  animation-fill-mode:forwards;

  -webkit-animation-duration:1s;
  -moz-animation-duration:1s;
  animation-duration:1s;
}

.fade-in.one {
  -webkit-animation-delay: 0.7s;
  -moz-animation-delay: 0.7s;
  animation-delay: 0.7s;
}

.fade-in.two {
  -webkit-animation-delay: 1.2s;
  -moz-animation-delay:1.2s;
  animation-delay: 1.2s;
}

.fade-in.three {
  -webkit-animation-delay: 1.6s;
  -moz-animation-delay: 1.6s;
  animation-delay: 1.6s;
}

/*---make a basic box ---*/
.box{
  width: 200px;
  height: 200px;
  position: relative;
  margin: 10px;
  float: left;
  border: 1px solid #333;
  background: #999;

}
代码语言:javascript
复制
<div class="container">
  <div class="box fade-in one">
    look at me fade in
  </div>

  <div class="box fade-in two">
    Oh hi! i can fade too!
  </div>

  <div class="box fade-in three">
    Oh hi! i can fade three!
  </div>
</div>

或者,您可以使用javascript来激活CSS动画。您可以在这里看到一个类似的示例http://www.virginholidays.co.uk/wonderlist

票数 0
EN

Stack Overflow用户

发布于 2016-05-27 06:07:57

你可以使用wow effects这是一个完整的库来创建css动画

你可以使用数据-哇-持续时间数据-哇-延迟下载css和js文件,你很快就可以上路了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37471610

复制
相关文章

相似问题

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