Looking for assistance in adding a fade effect to change the background image of a div element. The background image changes correctly, but I'm struggling with implementing the fade effect. Any help is appreciated!
Check out my code here: My JsFiddle
CSS:
.heroSecWrapper{
height: auto;
margin-left: 0%;
margin-right: 0px;
min-height: 100%;
width: 100%;
float: left;
background-image: linear-gradient(270deg,rgba(0, 0, 0, 0.4) 0%,rgba(255,255,255,0) 50%,rgba(0, 0, 0, 0.4) 100%),url("http://i.imgur.com/VnVlMwd.jpg");
background-attachment: scroll, fixed !important;
background-size: auto, 100% !important;
background-color: rgb(155, 155, 155) !important;
min-width: 0px;
-webkit-filter: contrast(100%);
background-position: 0% 11% !important;
background-repeat: repeat repeat !important;
-webkit-transition: all 1s ease-in-out !important;
-moz-transition: all 1s ease-in-out !important;
-o-transition: all 1s ease-in-out !important;
transition: all 1s ease-in-out !important;
}
Javascript:
var images=['http://i.imgur.com/U9IvuVv.jpg','http://i.imgur.com/dQsJrE0.jpg','http://i.imgur.com/VnVlMwd.jpg','http://i.imgur.com/uAUmF8M.jpg','http://i.imgur.com/UTcqXd3.jpg'];
var slideImageIndex=0;
var slideshow = setInterval(function(){
$('.heroSecWrapper').css({
background: 'linear-gradient(270deg,rgba(0, 0, 0, 0.4) 0%,rgba(255,255,255,0) 50%,rgba(0, 0, 0, 0.4) 100%),url("'+images[slideImageIndex]+'")'}).css({
background: '-webkit-linear-gradient(270deg,rgba(0, 0, 0, 0.4) 0%,rgba(255,255,255,0) 50%,rgba(0, 0, 0, 0.4) 100%),url("'+images[slideImageIndex]+'")'}).css({
background: '-moz-linear-gradient(270deg,rgba(0, 0, 0, 0.4) 0%,rgba(255,255,255,0) 50%,rgba(0, 0, 0, 0.4) 100%),url("'+images[slideImageIndex]+'")'}).css({
background: '-mz-linear-gradient(270deg,rgba(0, 0, 0, 0.4) 0%,rgba(255,255,255,0) 50%,rgba(0, 0, 0, 0.4) 100%),url("'+images[slideImageIndex]+'")'
})
if(slideImageIndex !=images.length-1){
slideImageIndex++;
}else{
slideImageIndex=0;
}
}, 2000);