Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS3 animation and background-image in Firefox

I have a bit of CSS3 animation in my website, and it works fine on Safari but when I run the site in Firefox, it doesn't animate. Here is the code:

.ad{
position:relative;
left:740px;
top:240px;
width:260px;
height:195px;
background-image:url('ad1.png');

animation:myfirst 4s; 

-webkit-animation:myfirst 4s; /* Safari and Chrome */
-webkit-animation-delay:2s;
-webkit-animation-duration:0s;
-webkit-animation-fill-mode: forwards;
}

@keyframes myfirst 

 {
  from {background-image:url('ad1.png')}
  to {background-image:url('ad2.png')}

 }


@-webkit-keyframes myfirst /* Safari and Chrome */
 {
  from {background-image:url('ad1.png');}
  to {background-image:url('ad2.png');}
 }
}

Now I've noticed that the issue arises when the site hits the

 background-image:url('');

if I were to change these to

 background:color;  

then it works, but obviously I want to use an image. I've tried adding -moz- prefixes, but it doesn't work. What am I missing? is there a way to make firefox acknowledge

Background-image:url('')
like image 639
Jcmoney1010 Avatar asked Oct 24 '25 13:10

Jcmoney1010


1 Answers

According to the latest working draft of the spec (14 August 2015), background-image is defined as non animatable.

Then, Firefox is just following the spec, and the behavior of browsers which animate background-image is non-standard and shouldn't be relied on.

like image 89
Oriol Avatar answered Oct 27 '25 03:10

Oriol