I have a script that rotates between an array of preloaded images at a set interval to change the background image. I'm using transitions (transition: background-image 2s ease
) to make the rotation crossfade, but this is currently only supported in Chrome.
I can modify the script using jQuery to animate the element to fade out, change the source and then fade back in, but enabling this script overrides Chrome's behaviour. As a side/alternate question, is it possible to emulate crossfading using jQuery?
How can I allow Chrome to use the CSS transition and force all other browsers to use the jQuery animation?
I am using Modernizr, but I don't think the feature detection would work as most other modern browsers get the csstransitions
class even if they don't support certain specific transitions like background-image
, but I would be happy if someone could prove me wrong.