jQuery/javascript slideshow on page background -
this trivial question , i've searched last 2 hours , have got lot of results. problem i've create slideshow background images. unfortunately none of them worked 100% me. last piece of code trying is,
<script type="text/javascript"> var images=new array('images/home.png','images/home02.png','images/home03.png'); var nextimage=0; doslideshow(); function doslideshow() { if(jquery('.slideshowimage').length!=0){ jquery('.slideshowimage').fadeout(500,function(){slideshowfadein();jquery(this).remove()}); } else{ slideshowfadein(); } } function slideshowfadein(){ jquery('body').prepend(jquery('<img class="slideshowimage" src="'+images[nextimage++]+'" style="display:none;z-index:-1">').fadein(500,function(){settimeout(doslideshow,3000);})); if(nextimage>=images.length) nextimage=0; }
the slideshow fine see prepending them image body doesn't make background instead takes separate space it. i've tried setting z-index:-1
,
src=jquery('<img class="slideshowimage" src="'+images[nextimage++]+'" style="display:none;z-index:-1">').fadein(500,function(){settimeout(doslideshow,3000);}); jquery('body').css('backgroundimage','url('+src+')';
in slideshowfadein()
function, none of them work. tried supersized , other plugin not best fit want.
i've been trying hours , need help. lot!
edit: jsfiddle link: http://jsfiddle.net/ttfmr/
if understood question correctly... trying put slideshow behind text?
if try http://jsfiddle.net/ttfmr/4/
img.slideshowimage { z-index: -1; position: absolute; top:0px; left:0px; display: block; }
there many ways position slideshow, "correct" way of positioning depend on specific situation.
Comments
Post a Comment