Javascript image rotator, kan ikke få den til glidende overgang
Jeg kan ikke få noget fade til at virke på denne rotator... men er heller ikke så skarp til javascriptvar bgimages=new Array()
bgimages[0]="/upload_dir/themes/web/shop003_theme001/graphics/topbilleder/bill1.jpg"
bgimages[1]="/upload_dir/themes/web/shop003_theme001/graphics/topbilleder/bill2.jpg"
bgimages[2]="/upload_dir/themes/web/shop003_theme001/graphics/topbilleder/bill3.jpg"
bgimages[3]="/upload_dir/themes/web/shop003_theme001/graphics/topbilleder/bill4.jpg"
bgimages[4]="/upload_dir/themes/web/shop003_theme001/graphics/topbilleder/bill5.jpg"
//preload images
var pathToImg=new Array()
for (i=0;i<bgimages.length;i++){
pathToImg[i]=new Image()
pathToImg[i].src=bgimages[i]
}
var inc=-1
function bgSlide(){
if (inc<bgimages.length-1)
inc++
else
inc=0
document.getElementById('rotatortop').style.background="url(" + pathToImg[inc].src + ")";
}
if (document.all||document.getElementById)
window.onload=new Function('setInterval("bgSlide()",3000)')
function fade(ost){
var fade_img = document.getElementById('old');
var opa = parseInt(fade_img.style.opacity)
fade_img.style.opacity = (opa -20);
if(fade_img.style.opacity > 0){
setTimeOut('fade('+ost+')',20);
}
}
function bgSlide(){
if (inc<bgimages.length-1)
inc++
else
inc=0
var hest = document.getElementById('rotatortop');
var old_img = hest.style.backgroundImage;
hest.innerHTML = '<img src="'+old_img+'" id="old">';
document.getElementById('rotatortop').style.background="url(" + pathToImg[inc].src + ")";
fade(hest);
}