[CenterFly II]

Beispiel

Variante zum Script "CenterFly I", bei dem sich die 4 von den Seiten hereinschwebenden Grafiken in der Mitte des Bildschirms zu einer Grafik überlagern. Bei diesem Beispiel wurde auf den Glow- Effekt verzichtet.

[Code]

[zwischen <HEAD> und </HEAD>]

<script language="JavaScript">

<!-- by nightfire (http://unix.nightfire.ch/)
var x1,y1,x2,y2,x3,y3,x4,y4,w,h,DistX,DistY,HopX,HopY,Count
var ImgW = 160 // Breite der Grafik
var ImgH = 160 // Höhe der Grafik
var Step = 500 // Anzahl Schritte (bestimmt Geschwindigkeit)
Count = 0

function init() {
// Bestimmung der Bildschirmmasse
if(document.all){
w=document.getElementsByTagName("body")[0].offsetWidth-22;
h=document.getElementsByTagName("body")[0].offsetHeight-10;
}
if(!document.all && document.getElementById){
w=window.innerWidth-22;
h=window.innerHeight-10;
}
// Bestimmung der Distanz
DistX=(h-ImgH)/2
DistY=(w-ImgW)/2
// Bestimmung der Anfangsposition der Bilder
x1 = 0
y1 = 0
x2 = 0
y2 = w-(ImgW)
x3 = h-(ImgH)
y3 = 0
x4 = h-(ImgH)
y4 = w-(ImgW)
// Distanz pro Durchgang
HopX = DistX/Step
HopY = DistY/Step
move_it();
}

function move_it() {
for (i=1; i<5; i++)
{
tempgif = "gif"+i
tempx = "x"+i
tempy = "y"+i
document.getElementById(tempgif).style.top= eval(tempx);
document.getElementById(tempgif).style.left=eval(tempy);
}
x1=x1+HopX
y1=y1+HopY
x2=x2+HopX
y2=y2-HopY
x3=x3-HopX
y3=y3+HopY
x4=x4-HopX
y4=y4-HopY
Count = Count + 1
if (Count <= Step) window.setTimeout("move_it()", 10);
}

//-->
</script>

[IN den <BODY> Tag]

onLoad="init();"

[zwischen <BODY> und </BODY>]

<div id="gif1" style="position:absolute;top:0px">
<img src="NF_icon.jpg" width="160" height="160" border="0">
</div>
<div id="gif2" style="position:absolute;top:0px">
<img src="NF_icon.jpg" width="160" height="160" border="0">
</div>
<div id="gif3" style="position:absolute;top:0px">
<img src="NF_icon.jpg" width="160" height="160" border="0">
</div>
<div id="gif4" style="position:absolute;top:0px">
<img src="NF_icon.jpg" width="160" height="160" border="0">
</div>

[Autor]

nightfire himself

[Download]

Kopieren Sie bitte den Code

Copyright © 1998- Nightfire Webworker Archiv Script No: 584