Code: Alles auswählen
<script type='text/javascript'>
<!--
// Updated Stars Script by kurt.grigg (at) virgin.net
var image='vogel.gif';
var amount=5; //Anzahl der Bilder!!
var yBase = 150;
var xBase = 200;
var step = .05;
var currStep = 0;
var Xpos = 5;
var Ypos = 5;
var i = 0;
var j = 0;
if (document.getElementById)
{
document.write('<div id="ieDiv" style="position:absolute;top:0px;left:0px">');
document.write('<div id="c" style="position:relative;">');
for (n=0; n < amount; n++) {
document.write('<img src="'+image+'" id="fledermausbild'+n+'" width="35" height="35" style="position:absolute;top:0px;left:0px">');
}
document.write('</div>');
document.write('</div>');
function MsieMouseFollow(e){
if (!e) {
Xpos = document.documentElement.scrollLeft+event.x-5;
Ypos = document.documentElement.scrollTop+event.y-5;
} else {
Xpos = e.pageX-5;
Ypos = e.pageY-5;
}
}
document.onmousemove = MsieMouseFollow;
}
else if (document.layers)
{
window.captureEvents(Event.MOUSEMOVE);
for (ns=0; ns < amount; ns++) {
document.write("<LAYER NAME='n"+ns+"' LEFT=0 TOP=0><IMG SRC='"+image+"'></LAYER>");
}
function NsMouseFollow(evnt){
Xpos = evnt.pageX-5;
Ypos = evnt.pageY-5;
}
window.onMouseMove = NsMouseFollow;
}
function Swirl(){
if (document.getElementById)
{
yBase = window.document.body.offsetHeight/4;
xBase = window.document.body.offsetWidth/4;
}
else if (document.layers)
{
yBase = window.innerHeight/4;
xBase = window.innerWidth/4;
}
if (document.getElementById) {
for (i=0;i<amount;i++) {
document.getElementById('fledermausbild'+i).style.top = Ypos + Math.cos((20*Math.sin(currStep/20))+i*70)*yBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep + i*25)/10)+"px";
document.getElementById('fledermausbild'+i).style.left = Xpos + Math.sin((20*Math.sin(currStep/20))+i*70)*xBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep + i*25)/10)+"px";
}
}
else if (document.layers)
{
for ( j = 0 ; j < ns ; j++ ) { //7 is number of NS layers!
var temp="n"+j
document.layers[temp].top = Ypos + Math.cos((20*Math.sin(currStep/20))+j*70)*yBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep + j*25)/10);
document.layers[temp].left =Xpos + Math.sin((20*Math.sin(currStep/20))+j*70)*xBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep + j*25)/10);
}
}
currStep += step;
setTimeout("Swirl()", 10);
}
//-->
</script>
<script type="text/javascript">Swirl();</script>