This Forum has been archived there is no more new posts or threads ... use this link to report any abusive content
==> Report abusive content in this page <==
Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What is wrong with this CSS3 code, it won't animate in Google Chrome, why?
05-05-2014, 08:37 AM
Post: #1
What is wrong with this CSS3 code, it won't animate in Google Chrome, why?
<!DOCTYPE html>
<html>

<head>
<style type="text/css">
.twitter-bird {
background-image: url

(http://minimalmonkey.com/lab/css3-

animations/twitter-bird-sprite.png);
display: inline-block;
height: 150px;
width: 150px;
}

.twitter-bird:hover {
animation: fly 0.2s steps(3) 0

infinite;
}

@keyframes fly {
from { background-position: 0 0; }
to { background-position: -450px 0;

}
}
</style>

</head>


<body>
<div class="twitter-bird">
</div>

</body>

</html>

Ads

Find all posts by this user
Quote this message in a reply
05-05-2014, 08:49 AM
Post: #2
 
For Google Chrome, need to specify "-webkit-" as prefix for both keyframes and animations. It does not support in Firefox also. because you are using background-position when hovering the twitter-bird.

Try this code:
<!DOCTYPE html>
<html>

<head>
<style type="text/css">
.twitter-bird {
background-image:url(http://minimalmonkey.com/lab/css3-animat...rite.png);
display: inline-block;
height: 150px;
width: 150px;
}

@keyframes fly {
from { background-position: 0 0; } to { background-position: -450px 0;} }

@-webkit-keyframes fly {
from { background-position: 0 0; } to { background-position: -450px 0;} }

.twitter-bird:hover {
animation: fly 0.2s steps(3) 0 infinite;
-webkit-animation: fly 0.2s steps(3) 0 infinite;
}


</style>

</head>


<body>
<div class="twitter-bird">
</div>

</body>

</html>

Ads

Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)