Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Schneefall erzeugen


Guest

Recommended Posts

Liebe Leute,

hätte gerne auf meiner index.php einen Schneefall

Alle Apps im Netz beziehen sich aber auf alte Versionen, wo es nch einen Header tag gab.

Wo/wie baue ich das nun in meine 2.3.3. ein?

Danke für Tips.

Andrea

Link to comment
Share on other sites

Also, 

index.php finden:

<?php
  }

  require(DIR_WS_INCLUDES . 'template_bottom.php');
  require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

 

danach einfügen:

<body>
<script src="js/snow.js" type="text/javascript"></script>
</body>

 

Anschliessend die Datei snow.js in den Ordner js einfügen. fertig ;)

snow.js

/*
 * Schnee-Script
 * @author Oliver Schlöbe <scripts@schloebe.de>
 * @example http://www.schloebe.de/scriptdemos/schloebe_snow/snowtest.html
 * @link http://www.schloebe.de/scripts/schnee-script/
 * @since 131219
 */

if( typeof schloebesnow === "undefined" ) {
	var schloebesnow = {
		no: 15, // Anzahl der Schneeflocken
		speed: 20, // "Schnei-Geschwindigkeit"; je kleiner die Zahl, um so schneller fallen die Flocken
		snowflake: "http://www.schloebe.de/wp-content/themes/schloebe_de/images/snow/snow.gif", // Bild der Schneeflocke, beliebig
		/*********************************/
		/** Ab hier nichts mehr ändern! **/
		/*********************************/
		ns4up: (navigator.appName=="Netscape" && navigator.appVersion.charAt(0)=="4") ? 1 : 0, // Browser Tester
		ie4up: (document.all) ? 1 : 0,
		ns6up: (document.getElementById&&!document.all) ? 1 : 0,
		i: 0,
		dx: new Array(),
		xp: new Array(),
		yp: new Array(),
		am: new Array(),
		stx: new Array(),
		sty: new Array(),
		doc_width: 800,
		doc_height: 800,
		
		let_it_snow: function() {
			if( this.ns4up || this.ns6up ) { // Bildschirm-Auflösung holen, Netscape-Funktion
				this.doc_width = self.innerWidth;
				this.doc_height = self.innerHeight;
			} else if( this.ie4up ) { // Bildschirm-Auflösung holen, Internet Explorer-Funktion
				this.doc_width = document.body.clientWidth;
				this.doc_height = document.body.clientHeight;
			}
			this.doc_height = (this.doc_height==0) ? document.documentElement.clientHeight : this.doc_height;
			
			for( this.i = 0; this.i < this.no; ++ this.i ) {
				this.dx[this.i] = 0; // Koordinaten-Variable setzen
				this.xp[this.i] = Math.random()*(this.doc_width-50); // Position-Variable setzen
				this.yp[this.i] = Math.random()*this.doc_height;
				this.am[this.i] = Math.random()*20; // Amplituden-Variable setzten
				this.stx[this.i] = 0.02 + Math.random()/10; // Variable für Schrittweite setzen
				this.sty[this.i] = 0.7 + Math.random(); // Variable für Schrittweite setzen
				
				if( this.ns4up ) {
					if (this.i == 0) {
						document.write("<layer name=\"dot"+ this.i +"\" left=\"15\" ");
						document.write("top=\"15\" visibility=\"show\"><img src=\"");
						document.write(this.snowflake + "\" border=\"0\"></layer>");
					} else {
						document.write("<layer name=\"dot"+ this.i +"\" left=\"15\" ");
						document.write("top=\"15\" visibility=\"show\"><img src=\"");
						document.write(this.snowflake + "\" border=\"0\"></layer>");
					}
				} else if( this.ie4up || this.ns6up ) {
					if (this.i == 0) {
						document.write("<div id=\"dot"+ this.i +"\" style=\"position: ");
						document.write("absolute; z-index: "+ this.i +"; visibility: ");
						document.write("visible; top: 15px; left: 15px;\"><img src=\"");
						document.write(this.snowflake + "\" border=\"0\"></div>");
					} else {
						document.write("<div id=\"dot"+ this.i +"\" style=\"position: ");
						document.write("absolute; z-index: "+ this.i +"; visibility: ");
						document.write("visible; top: 15px; left: 15px;\"><img src=\"");
						document.write(this.snowflake + "\" border=\"0\"></div>");
					}
				}
			}
		
			if( this.ns4up ) {
				this.snowNS();
			} else if( this.ie4up ) {
				this.snowIE();
			}else if( this.ns6up ) {
				this.snowNS6();
			}
			
			//schloebesnow.ossnow_called = true;
		},
		
		/*
		 * Haupt-Animations-Funktion für Netscape
		 */
		snowNS: function() {
			for( this.i = 0; this.i < this.no; ++ this.i ) {
				this.yp[this.i] += this.sty[this.i];
				if( this.yp[this.i] > this.doc_height-50 ) {
					this.xp[this.i] = Math.random()*(this.doc_width-this.am[this.i]-30);
					this.yp[this.i] = 0;
					this.stx[this.i] = 0.02 + Math.random()/10;
					this.sty[this.i] = 0.7 + Math.random();
					this.doc_width = self.innerWidth;
					this.doc_height = self.innerHeight;
					this.doc_height = (this.doc_height==0) ? document.documentElement.clientHeight : this.doc_height;
				}
				this.dx[this.i] += this.stx[this.i];
				document.layers["dot"+this.i].top = this.yp[this.i];
				document.layers["dot"+this.i].left = this.xp[this.i] + this.am[this.i]*Math.sin(this.dx[this.i]);
			}
			setTimeout("schloebesnow.snowNS()", this.speed);
		},
		
		/*
		 * Haupt-Animations-Funktion für Internet Explorer
		 */
		snowIE: function() {
			for( this.i = 0; this.i < this.no; ++ this.i ) {
				this.yp[this.i] += this.sty[this.i];
				if( this.yp[this.i] > this.doc_height-50 ) {
					this.xp[this.i] = Math.random()*(this.doc_width-this.am[this.i]-30);
					this.yp[this.i] = 0;
					this.stx[this.i] = 0.02 + Math.random()/10;
					this.sty[this.i] = 0.7 + Math.random();
					this.doc_width = document.body.clientWidth;
					this.doc_height = document.body.clientHeight;
					this.doc_height = (this.doc_height==0) ? document.documentElement.clientHeight : this.doc_height;
				}
				this.dx[this.i] += this.stx[this.i];
				document.all["dot"+this.i].style.pixelTop = this.yp[this.i];
				document.all["dot"+this.i].style.pixelLeft = this.xp[this.i] + this.am[this.i]*Math.sin(this.dx[this.i]);
			}
			setTimeout("schloebesnow.snowIE()", this.speed);
		},
		
		/*
		 * Haupt-Animations-Funktion für Netscape6 und Mozilla
		 */
		snowNS6: function() {
			for( this.i = 0; this.i < this.no; ++ this.i ) {
				this.yp[this.i] += this.sty[this.i];
				if( this.yp[this.i] > this.doc_height-50 ) {
					this.xp[this.i] = Math.random()*(this.doc_width-this.am[this.i]-30);
					this.yp[this.i] = 0;
					this.stx[this.i] = 0.02 + Math.random()/10;
					this.sty[this.i] = 0.7 + Math.random();
					this.doc_width = self.innerWidth;
					this.doc_height = self.innerHeight;
					this.doc_height = (this.doc_height==0) ? document.documentElement.clientHeight : this.doc_height;
				}
				this.dx[this.i] += this.stx[this.i];
				document.getElementById("dot"+this.i).style.top = this.yp[this.i]+"px";
				document.getElementById("dot"+this.i).style.left = this.xp[this.i] + this.am[this.i]*Math.sin(this.dx[this.i])+"px";
			}
			setTimeout("schloebesnow.snowNS6()", this.speed);
		}
	}
	
	schloebesnow.let_it_snow();
}

 

Link to comment
Share on other sites

×
×
  • Create New...