css动画执行保持forwards,使用CSS3 animation-fill-mode: forwards实现的渐变填充图片转场效果...

CSS

语言:

CSSSCSS

确定

html,

body {

height: 100%;

overflow: hidden;

background: #eee;

}

@keyframes animateSlides {

0% {

width: 0;

}

100% {

width: 100%;

}

}

#slider {

width: 467px;

height: 350px;

border-radius: 3px;

border: 1px solid rgba(0, 0, 0, 0.05);

box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);

margin: 0 auto;

position: relative;

top: 50%;

transform: translateY(-50%);

background: rgba(0, 0, 0, 0.5);

overflow: hidden;

}

#slider .slide-1,

#slider .slide-2,

#slider .slide-3 {

width: 0;

height: 100%;

position: absolute;

top: 0;

left: 0;

right: auto;

bottom: auto;

background-color: transparent;

background-repeat: no-repeat;

background-position: left center;

/* Fallback */

background-size: auto 100%;

transition: all 0.3s ease-in-out;

}

#slider .slide-1 {

width: 100%;

z-index: 1;

background-image: url(/uploads/141102/tumblr_1.jpg);

animation-delay: 0;

}

#slider .slide-2 {

z-index: 2;

background-image: url(/uploads/141102/tumblr_2.jpg);

animation: animateSlides 3s linear;

animation-delay: 3s;

}

#slider .slide-3 {

z-index: 3;

background-image: url(/uploads/141102/tumblr_1.jpg);

animation: animateSlides 3s linear;

animation-delay: 9s;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值