Seite 2 von 2

Verfasst: 30.11.2007 18:52
von Kendoo
Der funktioniert auch im FF

Code: Alles auswählen

<script>
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 = 14;
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:-100px;}<\/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+"px";
		obj.top=top+"px";
	}
}

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;
</script>

Verfasst: 30.11.2007 18:55
von Skippy07
Hallo!

Und in welche Datei bau ich den Code jetzt am besten ein.
Vielen Dank.

Gruss
Stefan

Verfasst: 30.11.2007 18:55
von Kendoo
overall_footer.html direkt über </body>

Verfasst: 30.11.2007 19:15
von Skippy07
Kleine Frage noch, wo bekomme ich die Grafiken für die Schneeflocken her?

Verfasst: 30.11.2007 19:19
von AllOutAnime
1000 Dank! Es geht :grin:

Verfasst: 22.12.2007 17:18
von exhale
jo wo gibts flocken?

Verfasst: 22.12.2007 19:58
von Dr.Death
OMG..... Schon etwas von " Google " und anderen Suchmaschinen gehört ?

Da kann man sogar nach Bildern suchen !

http://images.google.de/images?gbv=2&sv ... flocke.gif

Verfasst: 23.12.2007 11:51
von Christian Spitzhüttl
Einen schönen guten Tag!

Das mit den Schneeflocken war eine schöne Idee!

- Edit1: Frage hat sich erledigt! -
- Edit2: Frage, kann ich dir Geschwindigkeit der Flocken auch erhöhen? Wenn ja, wie? -

Vielen Dank für Eure Hilfe!

Frohe Weihnachten!

Christian

Verfasst: 23.12.2007 13:38
von Kendoo
ändere mal var T, ein kleinerer Wert sollte das Ganze beschleunigen