setinterval - Jquery background-image cycle w/fade-in/out -
how can change progressive fade-in/fade-out commented out applies background image , not whole containing div?
in current state entire div along content fading in/out along background image change, need crossfade or fadein/out apply background images transition. i understand why it's applying whole div, not figuring out how write differently affecting background-image.
$(window).load(function() { var =0; var images = []; images[ 0 ] = 'images/image1.jpg'; images[ 1 ] = 'images/image2.jpg'; images[ 2 ] = 'images/image3.jpg'; images[ 3 ] = 'images/image4.jpg'; var image = $('#container'); //initial background image setup image.css('background-image', 'url(images/image4.jpg)'); //change image @ regular intervals setinterval(function(){ //image.fadeout(1000, function () { image.css('background-image', 'url(' + images [i++] +')'); //image.fadein(1000); //}); if(i == images.length) = 0; }, 5000); });
you can not fade out background image. or nothing kind of thing. put image on element beneath current div using z-index , fade in or out.
Comments
Post a Comment