...

View Full Version : getting more than one kind of snowflake falling



llizard
12-18-2005, 03:05 PM
I am NOT a programmer but I have tweaked the snow script at http://www.dynamicdrive.com/dynamicindex3/snow.htm so I am not certain that what I have done is optimal. There are no errors being thrown though....

My question is this: am I asking for trouble and will the page be overloaded with js and just grind to a halt on some systems? (I have highspeed access so there is virtually no problem loading the page for me.)

Added to the javascript:



//Configure below to change URL path to the snow image
var snowsrc = "images/snow6.gif"; // 97 bytes

// llizard - display 5 more snowflakes and add a number of else if statements....
var snowsrc1 = "images/snow1.gif"; // 85bytes
var snowsrc2 = "images/snow2.gif"; // 99 bytes
var snowsrc3 = "images/snow3.gif"; // 76 bytes
var snowsrc4 = "images/snow4.gif"; // 85 bytes
var snowsrc5 = "images/snow5.gif"; // 85 bytes

// Configure below to change number of snowflakes to render
var no = 50;


Added further down to the javascript:


// llizard - add all those else if statements before the final else statement
if (ie4up||ns6up) {
if (i == 0) {
document.write('<div id="dot'+ i +'" class="flake" style="position: absolute; Z-INDEX: '+ i +'; visibility: visible; top: 15px; left: 15px;"><a href="http://dynamicdrive.com"><img src="'+snowsrc4+'" border="0"><\/a><\/div>');
} else if (i >= 1 && i < 10) {
document.write('<div id="dot'+ i +'" style="position: absolute; Z-INDEX: '+ i +'; visibility: visible; top: 15px; left: 15px;" class="flake"><img src="'+snowsrc+'" border="0"><\/div>');
} else if (i >= 10 && i < 15) {
document.write('<div id="dot'+ i +'" style="position: absolute; Z-INDEX: '+ i +'; visibility: visible; top: 15px; left: 15px;" class="flake"><img src="'+snowsrc1+'" border="0"><\/div>');
} else if (i >= 15 && i < 20) {
document.write('<div id="dot'+ i +'" style="position: absolute; Z-INDEX: '+ i +'; visibility: visible; top: 15px; left: 15px;" class="flake"><img src="'+snowsrc2+'" border="0"><\/div>');
} else if (i >= 20 && i < 25) {
document.write('<div id="dot'+ i +'" style="position: absolute; Z-INDEX: '+ i +'; visibility: visible; top: 15px; left: 15px;" class="flake"><img src="'+snowsrc5+'" border="0"><\/div>');
} else {
document.write('<div id="dot'+ i +'" style="position: absolute; Z-INDEX: '+ i +'; visibility: visible; top: 15px; left: 15px;" class="flake"><img src="'+snowsrc3+'" border="0"><\/div>');
}
}

And in the CSS file:



.flake a {text-decoration:none;}


And finally on the page itself, I added links to stop and start snowing (using javascript so that the links won't show if javascript is turned off)


<script type="text/javascript">
document.write ('<a href="#" onclick="hidesnow(); return false;" title="make it stop!">make it stop snowing!<\/a> * <a href="#" onClick="location.reload();return false" title="I love lots of snow">Let it snow!<\/a>');
</script>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum