Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JS] Płatki śniegu na stronie - problem, platki pojawiaja sie do ok 70% strony, nizej nie ma
sw04
post
Post #1





Grupa: Zarejestrowani
Postów: 21
Pomógł: 0
Dołączył: 15.11.2005
Skąd: ZaBrzE

Ostrzeżenie: (0%)
-----


taki problem mam
mam skrypt ktory "wypuszcza" z gory strony platki sniegu. problem w tym ze zamiast na samym dole to traca sie one gdzies po ok. 70%. tzn przez pierwsze 70% strony platki sa, nizej juz nei (IMG:http://forum.php.pl/style_emoticons/default/blinksmiley.gif)
da rade zrobic zeby pokazywaly sie na calej stronie? (IMG:http://forum.php.pl/style_emoticons/default/sadsmiley02.gif)

zamieszczam kod (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

pozdrawiam

ps. nie ma przycisku do pokazywania JS wiec uzylem opcji do php



  1. <?php
  2. <script language="JavaScript1.2">
  3.  
  4. /*
  5. Snow Effect Script
  6. Submitted by Altan d.o.o. (snow@altan.hr, <a href=\"http://www.altan.hr/snow/index.html)\" target=\"_blank\">http://www.altan.hr/snow/index.html)</a>
  7. Permission granted to Dynamicdrive.com to feature script in archive
  8. For full source code to this script, visit <a href=\"http://dynamicdrive.com\" target=\"_blank\">http://dynamicdrive.com</a>
  9. */
  10.  
  11.  
  12. //Configure below to change URL path to the snow image
  13. var snowsrc="http://img506.imageshack.us/img506/4899/snieg5cg.gif"
  14. // Configure below to change number of snow to render
  15. var no = 10;
  16.  
  17. var ns4up = (document.layers) ? 1 : 0; // browser sniffer
  18. var ie4up = (document.all) ? 1 : 0;
  19. var ns6up = (document.getElementById&&!document.all) ? 1 : 0;
  20.  
  21. var dx, xp, yp; // coordinate and position variables
  22. var am, stx, sty; // amplitude and step variables
  23. var i, doc_width = 1024, doc_height = 768;
  24.  
  25. if (ns4up||ns6up) {
  26. doc_width = self.innerWidth;
  27. doc_height = self.innerHeight;
  28. } else if (ie4up) {
  29. doc_width = document.body.clientWidth;
  30. doc_height = document.body.clientHeight;
  31. }
  32.  
  33. dx = new Array();
  34. xp = new Array();
  35. yp = new Array();
  36. am = new Array();
  37. stx = new Array();
  38. sty = new Array();
  39.  
  40. for (= 0; i < no; ++ i) {
  41. dx[i] = 0; // set coordinate variables
  42. xp[i] = Math.random()*(doc_width-10); // set position variables
  43. yp[i] = Math.random()*doc_height;
  44. am[i] = Math.random()*20; // set amplitude variables
  45. stx[i] = 0.02 + Math.random()/10; // set step variables
  46. sty[i] = 0.+ Math.random(); // set step variables
  47. if (ns4up) { // set layers
  48. if (== 0) {
  49. document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><a href=\"http://dynamicdrive.com/\"><img src='"+snowsrc+"' border=\"0\"></a></layer>");
  50. } else {
  51. document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src='"+snowsrc+"' border=\"0\"></layer>");
  52. }
  53. } else if (ie4up||ns6up) {
  54. if (== 0) {
  55. document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><a href=\"http://dynamicdrive.com\"><img src='"+snowsrc+"' border=\"0\"></a></div>");
  56. } else {
  57. document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"></div>");
  58. }
  59. }
  60. }
  61.  
  62. function snowNS() { // Netscape main animation function
  63. for (= 0; i < no; ++ i) { // iterate for every dot
  64. yp[i] += sty[i];
  65. if (yp[i] > doc_height-50) {
  66. xp[i] = Math.random()*(doc_width-am[i]-30);
  67. yp[i] = 0;
  68. stx[i] = 0.02 + Math.random()/10;
  69. sty[i] = 0.+ Math.random();
  70. doc_width = self.innerWidth;
  71. doc_height = self.innerHeight;
  72. }
  73. dx[i] += stx[i];
  74. document.layers["dot"+i].top = yp[i];
  75. document.layers["dot"+i].left = xp[i] + am[i]*Math.sin(dx[i]);
  76. }
  77. setTimeout("snowNS()", 10);
  78. }
  79.  
  80. function snowIE_NS6() { // IE and NS6 main animation function
  81. for (= 0; i < no; ++ i) { // iterate for every dot
  82. yp[i] += sty[i];
  83. if (yp[i] > doc_height-50) {
  84. xp[i] = Math.random()*(doc_width-am[i]-10);
  85. yp[i] = 0;
  86. stx[i] = 0.02 + Math.random()/10;
  87. sty[i] = 0.+ Math.random();
  88. doc_width = ns6up?window.innerWidth : document.body.clientWidth;
  89. doc_height = ns6up?window.innerHeight : document.body.clientHeight;
  90. }
  91. dx[i] += stx[i];
  92. if (ie4up){
  93. document.all["dot"+i].style.pixelTop = yp[i];
  94. document.all["dot"+i].style.pixelLeft = xp[i] + am[i]*Math.sin(dx[i]);
  95. }
  96. else if (ns6up){
  97. document.getElementById("dot"+i).style.top=yp[i];
  98. document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i]);
  99. }
  100. }
  101. setTimeout("snowIE_NS6()", 10);
  102. }
  103.  
  104. if (ns4up) {
  105. snowNS();
  106. } else if (ie4up||ns6up) {
  107. snowIE_NS6();
  108. }
  109.  
  110. </script>
  111. ?>


Ten post edytował sw04 21.12.2007, 15:50:11
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 22:28