简体   繁体   中英

Transition doesn't work in Firefox

I want to change div's background image smoothly when user hovers mouse on element, so I use this code


$("#bg").css({'background-image':'url("'+$(images[background_id]).attr("src")+'")', 'background-size':'cover', 'transition': '1.5s','-webkit-transition' : '1.5s'});

In Chrome it works fine, but in FF background is changing immediately

According to Mozilla docs, background-image transitions aren't supported by Firefox.

https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_animated_properties

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM