javascript - How do I use CSS3 animate to move the background image of a div up and down? -
<div class="abc"> </div> .abc{ background: url("blah.jpg") no-repeat; width:200px; height:200px; } my background image 200 x 600. how move , down div (i want div remain 200x200, longer image goes , down.)
i don't want use javascript this. (because doing way won't use hardware , slow.)
@keyframes bounce-background { { background-position: top; } 50% { background-position: bottom; } { background-position: top; } } .abc { animation-name: bounce-background; animation-timing-function: ease-in-out; animation-duration: 2s; animation-iteration-count: infinite; /* 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 browsers you're supporting (e.g. @-moz-keyframes @-o-keyframes @-webkit-keyframes etc.).
Comments
Post a Comment