Hi there,
Ich habe von einer niederländischen Seite ein lustiges Confetti Script gefunden dass ich gerne für eine Online-Einladungskarte verwenden möchte.
Leider funktioniert das nur unter IE. Kann mir evtl. jmd sagen ob es ohne viel Aufwand möglich wäre das so abzuändern dass es sowohl unter IE als auch unter Firefox läuft..?
Ist ganz einfach möglich. Wenn Dir der NetscapeNavigator 4.x egal ist, dann mußt Du nur ein paar Zeilen ersetzen und heraus kommt:
<SCRIPT language=JavaScript>
Amount=20; //aantal confetti stukjes
//Pre-load van de plaatjes
Image0=new Image();
Image0.src="con1.gif";
Image1=new Image();
Image1.src="con2.gif";
Image2=new Image();
Image2.src="con3.gif";
Image3=new Image();
Image3.src="con4.gif";
Image4=new Image();
Image4.src="con5.gif";
grphcs=new Array(5)
grphcs[0]="con1.gif"
grphcs[1]="con2.gif"
grphcs[2]="con3.gif"
grphcs[3]="con4.gif"
grphcs[4]="con5.gif"
Ypos=new Array();
Xpos=new Array();
Speed=new Array();
Step=new Array();
Cstep=new Array();
ns=(document.layers)?1:0;
for (i = 0; i < Amount; i++){
var P=Math.floor(Math.random()*grphcs.length);
rndPic=grphcs[P];
document.write('<img id="si'+i+'" src="'+rndPic+'" style="position:absolute;top:0px;left:0px">');
}
WinHeight=(document.layers)?window.innerHeight:window.document.body.clientHeight;
WinWidth=(document.layers)?window.innerWidth:window.document.body.clientWidth;
for (i=0; i < Amount; i++){
Ypos[i] = Math.round(Math.random()*WinHeight);
Xpos[i] = Math.round(Math.random()*WinWidth);
Speed[i]= Math.random()*3+2;
Cstep[i]=0;
Step[i]=Math.random()*0.1+0.05;
}
function fall(){
var WinHeight=(document.layers)?window.innerHeight:window.document.body.clientHeight;
var WinWidth=(document.layers)?window.innerWidth:window.document.body.clientWidth;
var hscrll=(document.layers)?window.pageYOffset:document.body.scrollTop;
var wscrll=(document.layers)?window.pageXOffset:document.body.scrollLeft;
for (i=0; i < Amount; i++){
sy = Speed[i]*Math.sin(90*Math.PI/180);
sx = Speed[i]*Math.cos(Cstep[i]);
Ypos[i]+=sy;
Xpos[i]+=sx;
if (Ypos[i] > WinHeight){
Ypos[i]=-60;
Xpos[i]=Math.round(Math.random()*WinWidth);
Speed[i]=Math.random()*5+2;
}
document.getElementById('si'+i).style.left=Xpos[i];
document.getElementById('si'+i).style.top=Ypos[i]+hscrll;
Cstep[i]+=Step[i];
}
setTimeout('fall()',40);
}
//-->
fall();
</SCRIPT>
Sollte funktionieren, alternativ kannst DU ja die Weichen für den NS 4.x drinnenlassen, steht aber nicht mehr dafür...