Image transitions not working in firefox

半世苍凉 提交于 2020-01-06 07:17:07

问题


http://jsfiddle.net/Lnykg/

When you hover over the image its supposed to fade transition into the other image, but in firefox the transition is broken. I tried adding a top: 0px; which was suggested from a similar question asked, but still doesn't work.

.infidus {
    margin-left: 0px;
    top: 0px;
    width:698px;
    height:300px;
    background: url();
    -moz-transition-duration: 0.7s;
    -webkit-transition-duration: 0.7s;
    transition-duration: 0.7s;
}

.infidus:hover {
    margin-top: 0px;
    top: 0px;
    width:698px;
    height:300px;
    background: url();
    -moz-transition-duration: 0.7s;
    -webkit-transition-duration: 0.7s;
    transition-duration: 0.7s;
} 

回答1:


According to w3c list of animatable properties background-image is not an animatable property. Although some browsers like chrome support this cross-fading behavior.

For firefox, bug 546052 is filed for this kind of transition.

However you can achieve what you want by doing some tricks that are described at the following links:

CSS3 background image transition

CSS3 Fade Effect



来源:https://stackoverflow.com/questions/19985365/image-transitions-not-working-in-firefox

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