I wrote the following function to change the background image of the page to the current slide in the slider but the fade effect only works in chrome. What do I change to make the same effect happen in other browsers?
onAfterChange: function (center, index) {
if (center.currentSlide === 0) {
$('body').css('backgroundImage' , "url('image1.jpg')");
} else if (center.currentSlide === 1) {
$('body').css('backgroundImage' , "url('image2.jpg')");
} else if (center.currentSlide === 2) {
$('body').css('backgroundImage' , "url('image3.jpg')");
} else if (center.currentSlide === 3) {
$('body').css('backgroundImage' , "url('image4.jpg')");
}
}
and the css I'm using looks like
-webkit-transition: background-image 1s ease;
-moz-transition: background-image 1s ease;
-ms-transition: background-image 1s ease;
-o-transition: background-image 1s ease;
transition: background-image 1s ease;