背景转换完成后要淡入的文本
text to fade in after background transition completed
我的背景有带过渡的图像。背景转换完成后,文本必须淡入。我使用了转换延迟,但它在mozilla中有效,而在chrome中无效。至于渐变效果,它在铬中有效,而在mozzilla中无效。现在,我只想让文本在延迟后淡出。请如何更正我的代码以实现这一点?
css
.text2
{
margin-top:10%;
margin-left:0;
padding-left:0;
/*fade in effect*/
transition-delay: 2s;
-moz-transition-delay:2s;
-o-transition-delay:2s;
-webkit-transition-delay:2s;
animation: fadein 2s;
-moz-animation: fadein 2s; /* Firefox */
-webkit-animation: fadein 2s; /* Safari and Chrome */
-o-animation: fadein 2s; /* Opera */
}
@keyframes fadein {
from {
opacity:0;
}
to {
opacity:1;
}
}
@-moz-keyframes fadein { /* Firefox */
from {
opacity:0;
}
to {
opacity:1;
}
}
@-webkit-keyframes fadein { /* Safari and Chrome */
from {
opacity:0;
}
to {
opacity:1;
}
}
@-o-keyframes fadein { /* Opera */
from {
opacity:0;
}
to {
opacity: 1;
}
}
#target {
position: relative;
left:0;
background-image:url('../img/top-bg.jpg');background-repeat:no-repeat;
width: 120%;
background-size:cover;
height: 600px;
background-position: 200px 50%;
transition: background-position 2s ease-in-out;
}
#target.wide{
left: -20%;
padding-left: 30%;
background-position: 0px 50%;
}
脚本
<script>
$(document).ready(function () {
$('#target').toggleClass("wide");
});
</script>
html
<div id="target">
<div class="small-12 medium-11 large-11 columns text2">
Beyond Law,<br/>
The Spirit of Innovation is Our strenght.
</div>
</div>
</div>
<div style="clear: both"></div>
链接:
http://vani.valse.com.my/beldon/index.php
编辑
text2
{
margin-top:10%;
margin-left:0;
padding-left:0;
/*fade in effect*/
**transition: opacity 0.5s ease-in;**
animation: fadein 2s;
-moz-animation: fadein 2s; /* Firefox */
-webkit-animation: fadein 2s; /* Safari and Chrome */
-o-animation: fadein 2s; /* Opera */
transition-delay: 2s;
-moz-transition-delay:2s;
-o-transition-delay:2s;
-webkit-transition-delay:2s;
}
添加了粗体行。它在mozilla中按需工作,但在chrome中转换延迟不起作用。
我在动画后添加了下面的行,如下所示,并使其在chrome中工作。
-webkit-animation-delay: 4s; /* Chrome, Safari, Opera */
/*to make the text not visible untill the transition starts*/
-webkit-opacity: 0;
/*without this the text will disappear after the animation*/
-webkit-animation-fill-mode: forwards;
所以在完整的中应该是这样的
.text2
{
margin-top:10%;
margin-left:0;
padding-left:0;
/*fade in effect*/
transition: opacity 0.5s ease-in;
-webkit-transition: opacity 0.5s ease-in;
-moz-transition: opacity 0.5s ease-in;
-o-transition: opacity 0.5s ease-in;
animation: fadein 4s;
-moz-animation: fadein 4s; /* Firefox */
-webkit-animation: fadein 4s; /* Safari and Chrome */
-o-animation: fadein 4s; /* Opera */
transition-delay: 4s;
-moz-transition-delay:4s;
-o-transition-delay:4s;
-webkit-transition-delay:4s;
-webkit-animation-delay: 4s; /* Chrome, Safari, Opera */
/*to make the text not visible untill the transition starts*/
-webkit-opacity: 0;
/*without this the text will disappear after the animation*/
-webkit-animation-fill-mode: forwards;
}
@keyframes fadein {
from {
opacity:0;
}
to {
opacity:1;
}
}
@-moz-keyframes fadein { /* Firefox */
from {
opacity:0;
}
to {
opacity:1;
}
}
@-webkit-keyframes fadein { /* Safari and Chrome */
from {
opacity:0;
}
to {
opacity:1;
}
}
@-o-keyframes fadein { /* Opera */
from {
opacity:0;
}
to {
opacity: 1;
}
}
相关文章:
- 文本淡入淡出后循环加载页面
- 文本淡入淡出jquery
- 动画文本淡入淡出
- 悬停在动画文本上后,文本淡入淡出不会返回
- 动画文本阴影以淡入淡出
- 如何在不丢失格式的情况下连续淡入() 元素文本的每个字符,包括嵌套元素
- 使用jquery单击事件淡入隐藏文本
- 背景转换完成后要淡入的文本
- 只需单击一次按钮,jquery即可自动淡入/淡出文本
- 如何使用jQuery淡入淡出文本
- 如何使用js-setTimeout延迟此文本的淡入
- 悬停在文本上,图像淡入淡出&出来
- 将鼠标悬停在文本上,图像淡入
- 如何在JS中构建纯文本淡入/淡出轮播(类似引导)
- 表格中单元格中的淡入淡出文本
- 文本粗细在淡入和淡出时更改
- 平滑地从普通文本淡入斜体文本
- 如何在vegaswalk背景库中淡入文本
- 仅使用Javascript的Qualtrics中的淡入淡出文本
- 使用Javascript延迟和淡入文本