Hi there, I am a little stuck with a slideshow I am developing.
On this site http://antobbo.webspace.virginmedia.com/petras/home.htm the slideshow is working fine, it is a javascript slideshow:
<script type = "text/javascript">
var imageList = new Array(
"images/homepage/home_0.jpg",
"images/homepage/home_1.jpg",
"images/homepage/home_2.jpg");
var frame = 0;
var image;
function init(){
setInterval("animate()",1000);
image = document.getElementById("home_page_image");
}
function animate(){
frame += 1;
if ( frame >= imageList.length ){
frame = 0;
}
image.src = imageList[frame];
}
</script>
But then I thought to myself: let's add a bit of fading and I changed the script and inserted a bit of jquery but it is not working http://antobbo.webspace.virginmedia.com/petras/test/home.htm. I was wondering if somebody could help me to determine why this is not working. The code, I think, makes sense...but, I might be wrong : - )
<script type = "text/javascript">
var imageList = new Array(
"images/homepage/home_0.jpg",
"images/homepage/home_1.jpg",
"images/homepage/home_2.jpg");
var frame = 0;
function init(){
setInterval("animate()",2000);
}
function animate(){
$("#"+ imageList[frame]).hide('fast');
frame += 1;
if ( frame >= imageList.length ){
frame = 0;
}
$("#" + imageList[frame]).show('fast');
}
</script>
Any idea at all? I thought it would have been straightforward.
thanks