Hab ich mir fast schon gedacht. Hier der Code mit Beispiel-Werten (Angegebene Dateien müssen nicht existieren)
var links = ['http://google.de','http://google.de'];
var texte=[' o y ',' asdas xyz '];
var bilder = ['ticker/18105-gefangene-steinpilze.png','ticker/18283-die-treppe-hoch.png'];
var wartezeit=5000;
var breite = 100;
var hoehe=100;
//Code
var id = "ticker\_"+(Math.round(Math.random()\*32768));
document.write(' ');
var mainDiv = document.getElementById(id);
mainDiv.innerHTML = " Daten werden geladen, bitte warten...";
var bildergeladen = [];
var prozent = 0;
var tmp = null;
var block = false;
function inArray(array,needle){
for(var i in array){
if(array[i] == needle)
return true;
}
return false;
}
function ladenbeenden(n,ok){
if(inArray(bildergeladen,n)==false){
bildergeladen[bildergeladen.length] = n;
if(ok == false){
var newnode = document.createElement("div");
newnode.style.display = "inline-block";
newnode.style.width = breite-2+"px";
newnode.style.height = hoehe-2+"px";
var zufallgrauwert = 55+Math.round(145\*Math.random());
newnode.style.backgroundColor = "rgb("+zufallgrauwert+","+zufallgrauwert+","+zufallgrauwert+")";
newnode.style.borderRadius = "7px";
var oldnodes = mainDiv.childNodes[0].childNodes[n].childNodes;
mainDiv.childNodes[0].childNodes[n].replaceChild(newnode,oldnodes[0]);
}
if(bildergeladen.length == bilder.length){
mainDiv.childNodes[0].childNodes[0].style.width = (mainDiv.offsetWidth-((bilder.length-1)\*breite))+"px";
mainDiv.innerHTML = mainDiv.childNodes[0].innerHTML;
if(wartezeit\>0){
setInterval("auto\_wechsel();",wartezeit-(-1000));
}
}
}
}
function auto\_wechsel(){
if(block==false)
ubergang(1);
}
function gehezu(n){
if(n==0)
location.href = links[n];
else
ubergang(n);
}
function ubergang(n){
prozent=0;
if(n!=1){
var tmp\_c = mainDiv.childNodes[1];
mainDiv.replaceChild(mainDiv.childNodes[n],mainDiv.childNodes[1]);
mainDiv.appendChild(tmp\_c);
}
tmp = setInterval("\_ubergang("+n+");",10);
}
function \_ubergang(n){
if(prozent=33){
if(prozent == 33){
mainDiv.childNodes[0].style.opacity = "0.0";
mainDiv.childNodes[0].style.filter = "alpha(opacity=0)";
mainDiv.childNodes[0].style.width = "0px";
}
mainDiv.childNodes[1].style.marginLeft = (1-(((prozent-33)\*3)/100))\*(mainDiv.offsetWidth-(bilder.length-1)\*breite)+"px";
mainDiv.childNodes[1].style.width = (parseInt(mainDiv.childNodes[1].style.marginLeft)=66){
if(prozent==66){
mainDiv.appendChild(mainDiv.childNodes[0]);
mainDiv.childNodes[bilder.length-1].style.width = breite+"px";
mainDiv.childNodes[0].style.marginLeft = "0px";
mainDiv.childNodes[0].style.width = (mainDiv.offsetWidth-((bilder.length-1)\*breite))+"px";
}
mainDiv.childNodes[0].childNodes[1].style.opacity = ((prozent-66)\*3)/100;
mainDiv.childNodes[0].childNodes[1].style.filter = "alpha(opacity="+((prozent-66)\*3)+")";
mainDiv.childNodes[bilder.length-1].style.opacity = ((prozent-66)\*3)/100;
mainDiv.childNodes[bilder.length-1].style.filter = "alpha(opacity="+((prozent-66)\*3)+")";
}
if(prozent == 100){
mainDiv.childNodes[0].childNodes[1].style.filter = "alpha(opacity=100)";
mainDiv.childNodes[0].childNodes[1].style.opacity = 1.0;
mainDiv.childNodes[bilder.length-1].style.filter = "alpha(opacity=100)";
mainDiv.childNodes[bilder.length-1].style.opacity = 1.0;
clearInterval(tmp);
var nt = [];
var nl = [];
var nb = [];
for(var i in texte){
for(var j in mainDiv.childNodes){
var cr = mainDiv.childNodes[j];
if(cr.innerHTML !== undefined){
if(texte[i] == cr.childNodes[1].innerHTML){
nt[j] = texte[i];
nl[j] = links[i];
nb[j] = bilder[i];
}
mainDiv.childNodes[j].setAttribute('onclick',"gehezu("+j+");");
}
}
}
texte = nt;
bilder = nb;
links = nl;
}
prozent++;
}
isDefined = function(variable){
return this[variable] === undefined ? false : true;
};
for(var i in texte){
mainDiv.childNodes[0].innerHTML += ' '+texte[i]+' ';
}
mainDiv.style.height = hoehe+"px";
mainDiv.style.overflow = "hidden";
grtz
michi