Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
[JS]Przycisk wyłączający skrypt
#1
Elo, zrobiłem sobie spadające elementy na stronie z tego poradnika

Cytat:////////////////////////////////////////////////////////////////
// Javascript made by Rasmus - http://www.peters1.dk //
////////////////////////////////////////////////////////////////

var SNOW_Picture = "link do spadającego elementu"
var SNOW_no = 15;

var SNOW_browser_IE_NS = (document.body.clientHeight) ? 1 : 0;
var SNOW_browser_MOZ = (self.innerWidth) ? 1 : 0;
var SNOW_browser_IE7 = (document.documentElement.clientHeight) ? 1 : 0;

var SNOW_Time;
var SNOW_dx, SNOW_xp, SNOW_yp;
var SNOW_am, SNOW_stx, SNOW_sty;
var i, SNOW_Browser_Width, SNOW_Browser_Height;

if (SNOW_browser_IE_NS)
{
SNOW_Browser_Width = document.body.clientWidth;
SNOW_Browser_Height = document.body.clientHeight;
}
else if (SNOW_browser_MOZ)
{
SNOW_Browser_Width = self.innerWidth - 20;
SNOW_Browser_Height = self.innerHeight;
}
else if (SNOW_browser_IE7)
{
SNOW_Browser_Width = document.documentElement.clientWidth;
SNOW_Browser_Height = document.documentElement.clientHeight;
}

SNOW_dx = new Array();
SNOW_xp = new Array();
SNOW_yp = new Array();
SNOW_am = new Array();
SNOW_stx = new Array();
SNOW_sty = new Array();

for (i = 0; i < SNOW_no; ++ i)
{
SNOW_dx[i] = 0;
SNOW_xp[i] = Math.random()*(SNOW_Browser_Width-50);
SNOW_yp[i] = Math.random()*SNOW_Browser_Height;
SNOW_am[i] = Math.random()*20;
SNOW_stx[i] = 0.02 + Math.random()/10;
SNOW_sty[i] = 0.7 + Math.random();
if (i == 0) document.write("<\div id=\"SNOW_flake"+ i +"\" style=\"position: absolute; z-index: "+ i +"; visibility: visible; top: 15px; left: 15px;\"><a href=\"http://www.peters1.dk\" target=\"_blank\"><\img src=\""+SNOW_Picture+"\" border=\"0\"></a><\/div>");
else document.write("<\div id=\"SNOW_flake"+ i +"\" style=\"position: absolute; z-index: "+ i +"; visibility: visible; top: 15px; left: 15px;\"><\img src=\""+SNOW_Picture+"\" border=\"0\"><\/div>");
}

function SNOW_Weather()
{

for (i = 0; i < SNOW_no; ++ i)
{
SNOW_yp[i] += SNOW_sty[i];

if (SNOW_yp[i] > SNOW_Browser_Height-50)
{
SNOW_xp[i] = Math.random()*(SNOW_Browser_Width-SNOW_am[i]-30);
SNOW_yp[i] = 0;
SNOW_stx[i] = 0.02 + Math.random()/10;
SNOW_sty[i] = 0.7 + Math.random();
}

SNOW_dx[i] += SNOW_stx[i];

document.getElementById("SNOW_flake"+i).style.top=SNOW_yp[i]+"px";
document.getElementById("SNOW_flake"+i).style.left=SNOW_xp[i] + SNOW_am[i]*Math.sin(SNOW_dx[i])+"px";
}

SNOW_Time = setTimeout("SNOW_Weather()", 10);

}

SNOW_Weather();


Wklej to do notatnika, uzupełnij i zapisz jako matrix.js , i wrzuć na ftp.

CYTAT
<script type="text/javascript" src="link do pliku matrix.js"></script>

Później wklej ten kod gdzie będziesz chciał.


Czy istnieje możliwość zrobienia na stronie 2 przycisków? Włączającego i wyłączającego ten skrypt?
Odpowiedz


Wiadomości w tym wątku
[JS]Przycisk wyłączający skrypt - przez Ratatuj1995 - 15-12-2010, 21:02

Podobne wątki…
Wątek: Autor Odpowiedzi: Wyświetleń: Ostatni post
  skrypt uruchamiajacy nowy link Arnimarl 1 2,888 26-05-2014, 00:34
Ostatni post: Kartofelek
  Własny przycisk play Olsz4k 1 2,766 28-05-2013, 18:27
Ostatni post: atp
  Poszukiwany skrypt/tutorial na niego Olsz4k 7 5,121 18-03-2013, 19:48
Ostatni post: kornell
  Poszukiwany skrypt/sposób Olsz4k 2 2,723 12-02-2013, 05:50
Ostatni post: Olsz4k
  CSS i skrypt na spadanie śniegu Reconnect 24 17,132 08-12-2012, 23:51
Ostatni post: Reconnect

Skocz do:


Użytkownicy przeglądający ten wątek:
Sponsorzy i przyjaciele
SeoHost.pl