admin管理员组文章数量:1392059
<div class="abc">
</div>
.abc{
background: url("blah.jpg") no-repeat;
width:200px;
height:200px;
}
My background image is 200 x 600. How do I move it up and down the div (I want the div to remain 200x200, but the longer image goes up and down.)
I don't want to use Javascript to do this. (Because doing it that way won't use the hardware and will be slow.)
<div class="abc">
</div>
.abc{
background: url("blah.jpg") no-repeat;
width:200px;
height:200px;
}
My background image is 200 x 600. How do I move it up and down the div (I want the div to remain 200x200, but the longer image goes up and down.)
I don't want to use Javascript to do this. (Because doing it that way won't use the hardware and will be slow.)
Share Improve this question edited Dec 3, 2010 at 3:25 TIMEX asked Dec 3, 2010 at 3:19 TIMEXTIMEX 273k368 gold badges802 silver badges1.1k bronze badges1 Answer
Reset to default 5@keyframes bounce-background {
from {
background-position: top;
}
50% {
background-position: bottom;
}
to {
background-position: top;
}
}
.abc {
animation-name: bounce-background;
animation-timing-function: ease-in-out;
animation-duration: 2s;
animation-iteration-count: infinite;
/* For Chrome & Safari */
-webkit-animation-name: bounce-background;
-webkit-animation-timing-function:ease-in-out;
-webkit-animation-duration:2s;
-webkit-animation-iteration-count:infinite;
}
You should repeat these non-finalized CSS3 properties under vendor prefixes for the browsers you're supporting (e.g. @-moz-keyframes
@-o-keyframes
@-webkit-keyframes
etc.).
本文标签: javascriptHow do I use CSS3 animate to move the background image of a div up and downStack Overflow
版权声明:本文标题:javascript - How do I use CSS3 animate to move the background image of a div up and down? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744783192a2624838.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论