PDA

View Full Version : snow falling script - can i have multiple images, not just snowflakes?



smoo1604
12-04-2012, 10:59 AM
Is it possible to have multiple images falling, ie snowflakes AND Christmas puddings??!!

I am a complete novice at javascript....!

Thanks

Shona :cool:

Beverleyh
12-04-2012, 01:13 PM
Its an oldie, but maybe this - you can specify different images in the script array: http://www.dynamicdrive.com/dynamicindex3/leaves.htm

Dont go too crazy with the number of images though or it can really slow things down.

smoo1604
12-04-2012, 02:52 PM
Ah perfect! thanks! (how do i slow down the speed a little?!!) i have used three images, and they are whizzing down the page!

Beverleyh
12-04-2012, 03:09 PM
See " setTimeout('fall()',20); " on one of the last lines?

Change the value to about 40, like this;

setTimeout('fall()',40);
I think a speed of 40-50 looks most "snowy".

smoo1604
12-04-2012, 03:18 PM
thanks! thats slowed it down a bit.

I have copied it into the body of my index.html page now but it doesnt work! i just get the three images on top of one another in top left corner...! http://www.frasersauctionroom.co.uk/

Beverleyh
12-04-2012, 03:25 PM
Have you sussed it?

I just checked and its working fine in IE9, Chrome and Firefox.

Beverleyh
12-04-2012, 03:27 PM
My mistake - it looks like there is another 'pudding' script in there instead.

Try taking that out and only using the slowed-down leaves one.

Beverleyh
12-04-2012, 03:37 PM
Scratch that - its down to the DOCTYPE.

It looks like this old script wont work with valid DOCTYPES - just a <html> tag.

smoo1604
12-04-2012, 04:02 PM
i have used a completely different script, and have two different images falling now by amending this part:


for (i = 0; i < no; ++ i) {
if(i % 2) {
snowsrc="christmas-pudding.gif";
} else {
snowsrc="snow3.gif";
}

(someone else showed me how to though, i have no clue about javascript really!)

ajfmrf
12-04-2012, 10:10 PM
I just clicked on the link and it works fine for me using ff 16.0.2