[BouncingText]

Schriftzug hüpft durchs Fenster ;-)

[Code]

[zwischen <HEAD> und </HEAD>]

<style type="text/css">
#supertext {
position:absolute;
left:0;
top:0;
visibility:hide;
visibility:hidden;
}
</style>

<script language="JavaScript1.2">

/*
Bouncy message script- By Dynamicdrive.com
Code based on Lloyd Hassell's, at http://www.dynamicdrive.com/dynamicindex4/bounceimage.htm
For full source, TOS, and 100s DTHML scripts, visit http://dynamicdrive.com
modified for DOM compatibility by N8i (www.nightfire.ch)
*/


//Konfigurieren Sie die folgenden drei Variablen

//1) Ihr Schriftzug (HTML möglich)
var thecontent='<h2><font color="#0000FF">Nightfire Webworker Archiv!</font></h2>'
//2) Hier können Sie festlegen, nach wievielen Millisekunden die Nachricht verschwinden soll. ('' = unendliche Anzeige)
var hidetimer='';
//3) Geschwindigkeit der Animation (1-50), je höher, desto schneller
var BallSpeed = 20;

///ab hier nichts mehr ändern///////////

var contentWidth;
var contentHeight;
var maxBallSpeed = 50;

var xMax;
var yMax;
var xPos = 0;
var yPos = 0;
var xDir = 'right';
var yDir = 'down';
var superballRunning = true;
var tempBallSpeed;
var currentBallSrc;
var newXDir;
var newYDir;

var ns4up = (document.layers) ? 1 : 0; // browser sniffer
var ie4up = (document.all) ? 1 : 0;
var mozup = (!document.all && document.getElementById) ? 1 : 0;

function initializeBall() {
if (ie4up) {
xMax = document.body.clientWidth;
yMax = document.body.clientHeight;
document.all("supertext").style.visibility = "visible";
contentWidth=supertext.offsetWidth;
contentHeight=supertext.offsetHeight;
}
else if (ns4up) {
xMax = window.innerWidth;
yMax = window.innerHeight;
contentWidth=document.supertext.document.width
contentHeight=document.supertext.document.height
document.layers["supertext"].visibility = "show";
}
else if (mozup) {
xMax = window.innerWidth;
yMax = window.innerHeight;
document.getElementById("supertext").style.visibility = "visible";
contentWidth=document.getElementById("supertext").style.width;
contentHeight=document.getElementById("supertext").style.height;
}


setTimeout('moveBall()',400);
if (hidetimer!='')
setTimeout("hidetext()",hidetimer)
}

function moveBall() {
if (superballRunning == true) {
calculatePosition();
if (ie4up) {
document.all("supertext").style.left = xPos + document.body.scrollLeft;
document.all("supertext").style.top = yPos + document.body.scrollTop;
}
else if (ns4up) {
document.layers["supertext"].left = xPos + pageXOffset;
document.layers["supertext"].top = yPos + pageYOffset;
}
else if (mozup) {
document.getElementById("supertext").style.left = xPos + window.pageXOffset;
document.getElementById("supertext").style.top = yPos + window.pageYOffset;
}
animatetext=setTimeout('moveBall()',20);
}
}

function calculatePosition() {
if (xDir == "right") {
if (xPos > (xMax - contentWidth - BallSpeed)) {
xDir = "left";
}
}
else if (xDir == "left") {
if (xPos < (0 + BallSpeed)) {
xDir = "right";
}
}
if (yDir == "down") {
if (yPos > (yMax - contentHeight - BallSpeed)) {
yDir = "up";
}
}
else if (yDir == "up") {
if (yPos < (0 + BallSpeed)) {
yDir = "down";
}
}
if (xDir == "right") {
xPos = xPos + BallSpeed;
}
else if (xDir == "left") {
xPos = xPos - BallSpeed;
}
else {
xPos = xPos;
}
if (yDir == "down") {
yPos = yPos + BallSpeed;
}
else if (yDir == "up") {
yPos = yPos - BallSpeed;
}
else {
yPos = yPos;
}
}

function hidetext(){
if (ie4up)
supertext.style.visibility="hidden";
else if (ns4up)
document.supertext.visibility="hide";
else if (mozup)
document.getElementById("supertext").style.visibility="hidden";
clearTimeout(animatetext)
}

if (document.all||document.layers||mozup){
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
window.onload = initializeBall;
window.onresize = new Function("window.location.reload()");
}

</script>

[Autor]

Dynamic Drive
DOM Modifikationen by N8i

[Download]

Kopieren Sie bitte den Code

Copyright © 1998- Nightfire Webworker Archiv Script No: 524