PDA

View Full Version : Controlling the Height of the Snow Dynamicaly



Styles2304
10-04-2007, 12:30 PM
I'm working on something for my Church's website so that I can have certain weather effects during certain events (christmas, east, etc...). I decided to use this code as it shows up the best on my website and I am most happy with it.

http://www.dynamicdrive.com/dynamicindex3/snow.htm

My question is this: the website I'm wanting to put this on grows and shrinks so how can I make the height and width of this applet dynamic?

Thank You,
Zach

jscheuer1
10-04-2007, 02:57 PM
My question is this: the website I'm wanting to put this on grows and shrinks so how can I make the height and width of this applet dynamic?

The same way? How does the site grow and shrink? There are many ways to have that happen. In any case, here (in the script's code) is where the snow img tags are written:


<img src='"+snowsrc+"' border=\"0\">

This actually occurs in two places. You could add a class or inline style. What style you would add or what style properties/values you would give to that class and/or how you would manipulate it via script, would depend upon what method the page uses to shrink and grow.

Whatever you add would need to follow the script's admittedly not too well though out syntax, and be placed in this bit of code both of the places where it appears in the script's code. For example, to add a class:


<img class='somename' src='"+snowsrc+"' border=\"0\">

Note the use of the single, in place of the usual double quotes. Or you could use escaped double quotes, as is already done in the code for the border attribute.

Styles2304
10-04-2007, 11:59 PM
I just ended up going with:


var i, doc_width = document.body.scrollWidth, doc_height = document.body.scrollHeight;

That seemed to solve all my problems . . . thanks for the input though!