Image transitions not working in firefox

2019-09-10 07: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条回答
\"骚年 ilove
2楼-- · 2019-09-10 07:19

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

查看更多
登录 后发表回答