Problem beim Einbauen von Schneeflocken
Verfasst: 29.11.2007 19:41
Ich wollte über die Weihnachtszeit Schneeflocken in mein phpBB Forum einbauen. Das script habe ich in die overall_header.html Datei im Template Ordner geschrieben, doch die Schneeflocken kleben nur links oben in der Ecke. Kann mir jemand helfen, das einzubauen, dass es auch funktioniert?
Code von den Schneeflocken:
Url zum Forum, wo ihr es sehr gut live sehen könnt
animefanboard.de
danke schonmal.
Code von den Schneeflocken:
Code: Alles auswählen
function getCookie(name) {
var arg = name + '=';
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
{
var endstr = document.cookie.indexOf(";", j);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(j, endstr));
}
i = document.cookie.indexOf(' ', i) + 1;
if (i == 0) break;
}
return null;
}
function hasApp()
{
var vals = String(getCookie('LYC')).split("&");
for (var i = 0; i < vals.length; i++)
{
var keyval = vals[i].split("=");
if (keyval[0] == "lc")
{
var lcvals = keyval[1].split(",");
return (lcvals[3] == "1");
}
}
return (getCookie('lcApp') == "1");
}
function launchRadio (clientStationID, playlistType, playlistModifier, djID, otherParams) {
var windowName = self.name;
if (windowName == '') {
windowName = 'LaunchRadioTarget';
self.name = windowName;
}
var path = "http://launchcast.launch.yahoo.com/radio/player/";
var qs = 'clientID=1&clientStationID=' + clientStationID + '&p=' + playlistType + '&m=' + playlistModifier + '&d=' + djID + '&linkTarget=' + windowName;
if (arguments[4] != null) qs += '&' + arguments[4];
if (hasApp())
window.top.location = path + 'createLCP.asp?appmode=0&closeWarning=0&' + qs;
else
radioWin = window.open(path + 'default.asp?' + qs, 'playerWindow', 'HEIGHT=' + (document.layers ? 314 - 30 : 314) + ',WIDTH=' + (document.layers ? 390 - 10 : 390));
}
function rnd(){return Math.random();}
function xRnd(){return (rnd()/10);}
function yRnd(){return (2 + 2*( .5 - rnd() ));}
var letitsnow = true;
var flakes = Array("snflake1.png","snflake2.png","snflake3.png","snflake4.png", "snflake5.png", "snflake6.png", "snflake7.png");
var numflakes = 15;
var T = 35;
var dx, xPos, yPos, am, vx, vy, obj, i;
var winwidth = 640;
var winheight = 480;
function sizeIt()
{
window.winwidth = window.innerWidth?window.innerWidth:document.body.clientWidth;
window.winheight = window.innerHeight?window.innerHeight:document.body.clientHeight;
}
dx = new Array();
xPos = new Array();
yPos = new Array();
sway = new Array();
var swaymax = 20;
vx = new Array();
vy = new Array();
sizeIt();
document.write("<STYLE type=\"text/css\">\n.flk {position:absolute;top:-100;}<\/STYLE>");
for (i = 0; i < numflakes; i++)
{
var thisflake = "" + flakes[Math.floor(rnd()*flakes.length)];
dx[i] = 0;
xPos[i] = rnd()*(window.winwidth-30) +10;
yPos[i] = rnd()*window.winheight;
sway[i] = rnd()*swaymax;
vx[i] = xRnd();
vy[i] = yRnd();
document.write("<div id=\"f"+ i +"\" class=\"flk\"><img src=\"");
document.write(thisflake + "\" border=\"0\"><\/div>");
}
function snowMove(id,left,top)
{
obj = document.getElementById?document.getElementById(id).style:
document.all?document.all[id].style:
document.layers?document.layers[id]:null;
if (obj)
{
obj.left=left;
obj.top=top;
}
}
function snowSwitch(s)
{
if ( s == "on" )
{
if ( window.letitsnow != true )
{
window.letitsnow = true;
doSnow();
}
} else if ( s == "off" )
{
window.letitsnow = false;
hideSnow();
}
}
function hideSnow()
{
for (i = 0; i < numflakes; ++ i) {
snowMove("f"+i,-100,-100);
}
}
function doSnow() {
if (letitsnow){
sizeIt();
delta = (window.pageYOffset!=null)?window.pageYOffset:document.body.scrollTop;
for (i = 0; i < numflakes; ++ i) {
yPos[i] += vy[i];
if (yPos[i] > window.winheight+delta-50) {
xPos[i] = rnd()*(window.winwidth-sway[i]-30);
yPos[i] = delta;
vx[i] = xRnd();
vy[i] = yRnd();
}
dx[i] += vx[i];
snowMove("f"+i,xPos[i]+sway[i]*Math.cos(dx[i]),yPos[i]);
}
setTimeout("doSnow()", T);
}
}
window.onload=doSnow;

danke schonmal.