Nét Đẹp Việt Nam

 Quên mật khẩu
 Register
Xem: 4121|Trả lời: 0
In Chủ đề trước Tiếp theo

JS Script Tuyết Rơi Giáng Sinh rất hay !

[Lấy địa chỉ]
Nhảy đến trang chỉ định
1#
Tạo 1 file Javascript với nội dung như sau:
  1. /******************************************
  2. * Snow Effect Script- By Altan d.o.o. (http://www.altan.hr/snow/index.html)
  3. * Visit Dynamic Drive DHTML code library (http://www.dynamicdrive.com/) for full source code
  4. * Last updated Nov 9th, 05' by DD. This notice must stay intact for use
  5. ******************************************/

  6. //Configure below to change URL path to the snow image
  7. var snowsrc="http://netdepviet.org/images/snow.gif"
  8. // Configure below to change number of snow to render
  9. var no = 10;
  10. // Configure whether snow should disappear after x seconds (0=never):
  11. var hidesnowtime = 0;
  12. // Configure how much snow should drop down before fading ("windowheight" or "pageheight")
  13. var snowdistance = "pageheight";

  14. ///////////Stop Config//////////////////////////////////

  15. var ie4up = (document.all) ? 1 : 0;
  16. var ns6up = (document.getElementById&&!document.all) ? 1 : 0;

  17. function iecompattest(){
  18. return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
  19. }

  20. var dx, xp, yp;    // coordinate and position variables
  21. var am, stx, sty;  // amplitude and step variables
  22. var i, doc_width = 800, doc_height = 600;

  23. if (ns6up) {
  24. doc_width = self.innerWidth;
  25. doc_height = self.innerHeight;
  26. } else if (ie4up) {
  27. doc_width = iecompattest().clientWidth;
  28. doc_height = iecompattest().clientHeight;
  29. }

  30. dx = new Array();
  31. xp = new Array();
  32. yp = new Array();
  33. am = new Array();
  34. stx = new Array();
  35. sty = new Array();
  36. snowsrc=(snowsrc.indexOf("dynamicdrive.com")!=-1)? "snow.gif" : snowsrc
  37. for (i = 0; i < no; ++ i) {
  38. dx[i] = 0;                        // set coordinate variables
  39. xp[i] = Math.random()*(doc_width-50);  // set position variables
  40. yp[i] = Math.random()*doc_height;
  41. am[i] = Math.random()*20;         // set amplitude variables
  42. stx[i] = 0.02 + Math.random()/10; // set step variables
  43. sty[i] = 0.7 + Math.random();     // set step variables
  44. if (ie4up||ns6up) {
  45. if (i == 0) {
  46. 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>");
  47. } else {
  48. document.write("<div id="dot"+ i +"" style="POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;"><img src='"+snowsrc+"' border="0"><\/div>");
  49. }
  50. }
  51. }

  52. function snowIE_NS6() {  // IE and NS6 main animation function
  53. doc_width = ns6up?window.innerWidth-10 : iecompattest().clientWidth-10;
  54. doc_height=(window.innerHeight && snowdistance=="windowheight")? window.innerHeight : (ie4up && snowdistance=="windowheight")?  iecompattest().clientHeight : (ie4up && !window.opera && snowdistance=="pageheight")? iecompattest().scrollHeight : iecompattest().offsetHeight;
  55. for (i = 0; i < no; ++ i) {  // iterate for every dot
  56. yp[i] += sty[i];
  57. if (yp[i] > doc_height-50) {
  58. xp[i] = Math.random()*(doc_width-am[i]-30);
  59. yp[i] = 0;
  60. stx[i] = 0.02 + Math.random()/10;
  61. sty[i] = 0.7 + Math.random();
  62. }
  63. dx[i] += stx[i];
  64. document.getElementById("dot"+i).style.top=yp[i]+"px";
  65. document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i])+"px";
  66. }
  67. snowtimer=setTimeout("snowIE_NS6()", 10);
  68. }

  69. function hidesnow(){
  70. if (window.snowtimer) clearTimeout(snowtimer)
  71. for (i=0; i<no; i++) document.getElementById("dot"+i).style.visibility="hidden"
  72. }


  73. if (ie4up||ns6up){
  74. snowIE_NS6();
  75. if (hidesnowtime>0)
  76. setTimeout("hidesnow()", hidesnowtime*1000)
  77. }
Sao chép mã
2, Save lại thành file: snowfall.js
3, Upload lên Hosting hoặc server . Bạn sẽ có đường dẫn file javascript ví dụ: http://netdepviet.org/vn/include/js/snowfall.js
4, Bạn thêm đoạn mã sau đây vào trước tag
</head>
của trang muốn tuyết rơi.
  1. <!--Snow Falls! Xmas's coming by Netdepviet.org!-->
  2. <script type="text/javascript" src="http://netdepviet.org/vn/include/js/snowfall.js"></script>
  3. <!--Snow Falls! Merry Xmas by Netdepviet.org!-->
Sao chép mã
5.  Có rất nhiều hình ảnh bông tuyết rất đẹp, bạn có thể tìm và chọn 1 hình ảnh đẹp cho riêng website của bạn! chúc các bạn đón giáng sinh vui vẻ
Bạn phải đăng nhập mới được đăng bài Đăng nhập | Register

Quy tắc điểm

Phòng tối|iPhone|Archiver|G+|Youtube|Facebook|Twitter|Contact| Netdepviet.org

GMT+7, 19-4-2024 08:14 PM , Processed in 0.014105 second(s), 16 queries .

Powered by Discuz! X3.2

© 2006 Made with in Hanoi,Vietnam and Contents are published by all members

Trả lời nhanh Lên trên Trở lại danh sách