Hi
I want to create a slideshow using the background image of a div. I don´t want the images to rotate automatically, instead I want to use standard prev and next buttons to change the div´s background image. In total there will be around 6 images to scroll through. It needs to be a background image as the div has some other content in it.
Think this can be achieved using JQuery but not sure how.
I have the following code which automatically rotates through the images, but I don´t want them to change automatically. I need to be able to scroll through the images using the next and prev buttons.
var bgArr = ["images/img-restaurante-2.jpg", "images/img-restaurante-3.jpg", "images/img-restaurante-4.jpg", "images/img-restaurante-5.jpg", "images/img-restaurante-1.jpg" ]; var i=0; // Start the slide show var interval = self.setInterval("swapBkgnd()", 20000) function swapBkgnd() { if (i>(bgArr.length-1) ) { i=0 $("#restaurante").css("background-image", "url("+bgArr[i]+")"); } else { $("#restaurante").css("background-image", "url("+bgArr[i]+")"); } i++; };
Can anyone help me?