views:

24

answers:

1

ok my slideshow is my body background and the imgs are in img tags like this

 <img name="pic" src="../../Content/images/bg.jpg" style="  width: 100%; position: absolute; top: 0; left: 0; z-index: -1;width: expression(document.body.clientWidth + 'px');   " alt=""/>

my problem is it plays but then stops on the last image instead of being continuous

also how would i implement a stop play prev next button a the top of the page that also controls the background i dont want to download no plugins if possible thanks

here is my code so far

  var pause = 3000;

var n = 0;

var imgs = new Array("bg.jpg", "bg2.jpg", "bg3.jpg", "bg4.jpg", "bg5.jpg", "bg6.jpg", "bg7.jpg", "bg8.jpg", "bg9.jpg", "bg10.jpg", "bg11.jpg");


var preload = new Array();
for (var i = 1; i < imgs.length; i++ ) {
    preload[i] = new Image();
    preload[i].src = imgs[i];
}

var inc = -1

function rotate() {

    document.images.pic.src = imgs[n];
    (n == (imgs.length - 1)) ? n = 0 : n++;
    setTimeout("rotate(0)", pause);
}
A: 

Possibly this?

n = ( n==imgs.length-1 ? 0 : n+1);
marsbard
still doesnt work firebug says missing ) in parenthetical when i use that
sam
You could try rearranging it as if/else... "if(n==imgs.length-1) n=0 else n++;"
marsbard
still nothing :( im still learning this
sam