CSS keyframes only works in Chrome

巧了我就是萌 提交于 2019-12-02 01:49:21

问题


i'm trying to make a simple animation using keyframes, but it only works in Chrome. Here is the code (i've only included keyframes code once, for shorter post):

@keyframes logokf {
    0% {
    background-image: url('gfx/logo1.png');
    }    
    20% {
    background-image: url('gfx/logo2.png');
    }    
    40% {
    background-image: url('gfx/logo3.png');
    }    
    60% {
    background-image: url('gfx/logo4.png');
    }    
    80% {
    background-image: url('gfx/logo1.png');
    }    
    100% {
    background-image: url('gfx/logo1.png');
    }

}


@-webkit-keyframes logokf {    
}

@-moz-keyframes logokf {             
}

@-o-keyframes logokf { 
}

@-ms-keyframes logokf {
}

#logo:hover {
float: left;
height: 75px;
margin: 28px 0 22px;
width: 276px;

/*animation-name*/
-webkit-animation-name:logokf;
-moz-animation-name:logokf;
-ms-animation-name:logokf;
-o-animation-name:logokf;
animation-name:logokf;

/*animation-duration*/
-webkit-animation-duration:1s;
-moz-animation-duration:1s;
-ms-animation-duration:1s;
-o-animation-duration:1s;
animation-duration:1s;

/*animation-iteration-count*/
-webkit-animation-iteration-count:infinite;
-moz-animation-iteration-count:infinite;
-ms-animation-iteration-count:infinite;
-o-animation-iteration-count:infinite;
animation-iteration-count:infinite;

/*animation-timing-function*/
-webkit-animation-timing-function:lineare;
-moz-animation-timing-function:lineare;
-ms-animation-timing-function:lineare;
-o-animation-timing-function:lineare;
animation-timing-function:lineare;

/*animation-delay*/
-webkit-animation-delay:0s;
-moz-animation-delay:0s;
-ms-animation-delay:0s;
-o-animation-delay:0s;
animation-delay:0s;

 }

Any thoughts of how can i fix it or keyframes are not yet supported from other browsers?


回答1:


background-image itself does not appear to be a valid transitionable property. It may happen to work in Chrome, but it's probably just lucky. When it's implemented, you'll be looking to use the crossfade capability in CSS images.



来源:https://stackoverflow.com/questions/12622598/css-keyframes-only-works-in-chrome

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!