i want to change my background image with fadeIn and fadeOut effect. i can change it using this code but i can't use fadeIn
and fadeOut
effect. how can i use this effects? i mean last background should have fadeOut
effect and next background should have fadeIn
effect.
note: background property is part of body and i don't want my elements in body take fadeIn
OR fadeOut
effect.
jquery:
$(document).ready(function(){
setInterval(function () {
$("body").css("background", "url(../img/2.jpg) center center no-repeat");
$("body").css("background-size", "cover");
}, 3000);
});
css:
body{
background: url(../img/1.jpg) center center no-repeat;
background-size: cover;
}