We have a school project where we are going to create a website. There is a requirement that we shall have a picture that ever 10s or so switch to a new picture. I was able to make it happen with an easy JavaScript code, but it does not look so good. There is no transition between the pictures. I wonder if someone can help me fix so that there is a transition when a picture switch to another one! Here is my javascript code:
var bilder = ["img/nature1.jpg","img/nature2.jpg","img/nature3.jpg","img/nature4.jpg"];
var count = 0;
function bildspel() {
document.getElementById("bildfram").src = bilder[count];
count++;
if (count > (bilder.length-1)) {
count = 0;
}
}
setInterval("bildspel()",10000);
Thanks in advance!