Results 1 to 5 of 5

Thread: Turning on/off the falling snow effect

  1. #1
    Join Date
    Jun 2005
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Turning on/off the falling snow effect

    I am looking at using the Snow Effect without images on my Christmas site but I would like to include a link to turn on/off the effect.
    I would like it on as default but offer the user the option to turn it off if they find it annoying.
    Can anyone help me out?
    Thanks

  2. #2
    Join Date
    Aug 2004
    Posts
    10,138
    Thanks
    3
    Thanked 1,007 Times in 992 Posts
    Blog Entries
    16

    Default

    Warning: Please include a link to the DD script in question in your post. See this thread for the proper posting format for asking a question.. In this case, link is: http://www.dynamicdrive.com/dynamicindex3/snow.htm

    Sure, to create such a link, first, locate the line inside the script:

    Code:
     snowtimer=setTimeout("snowIE_NS6()", 10);
    The part in red needs to be added into the original code.

    Then, add the below extra code to the script:

    Code:
     
      function hidesnow(){
      if (window.snowtimer){
      clearTimeout(snowtimer)
      for (i = 0; i < no; ++ i)
      document.getElementById("dot"+i).style.visibility="hidden"
      }
      }
    Finally, in your HTML, create the link to hide the snow effect:

    Code:
    <a href="javascript: hidesnow()">Hide snow</a>

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,373
    Thanks
    77
    Thanked 3,421 Times in 3,382 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by ddadmin
    Warning: Please include a link to the DD script in question in your post. See this thread for the proper posting format for asking a question.. In this case, link is: http://www.dynamicdrive.com/dynamicindex3/snow.htm
    Another good reason to supply the link to the script - unless I am mistaken, the OP is using the snow without images script not the one with images you just so artfully answered his question for. Don't feel bad, I've been doing a bit of that lately. Also the OP wanted, I think, to be able to turn it back on. I came up with this mod of the snow.js file that comes with 'Snow Effect without images' - at the very end of snow.js where it looks like so:

    Code:
    })();
    }//End.
    Make it like so (additions red):

    Code:
    })();
    }
    function setFlakes(el){
    var val=el.value? el.value : el.innerHTML
    var hf=document.getElementsByTagName('div')
    for (var i_tem = 0; i_tem < hf.length; i_tem++)
    if (hf[i_tem].id.indexOf('flake')!==-1)
    hf[i_tem].style.display=val=="Stop Snow"? 'none' : ''
    if(el.value)
    el.value=val=="Stop Snow"? 'Start Snow' : 'Stop Snow'
    else
    el.innerHTML=val=="Stop Snow"? 'Start Snow' : 'Stop Snow'
    }//End.
    Then put this link on your page:

    HTML Code:
    <a href="#" onclick="setFlakes(this);return false;">Stop Snow</a>
    OR this snazzy button (don't use both):

    HTML Code:
    <input id="control" type="button" value="Stop Snow" onclick="setFlakes(this);">
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Jun 2005
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks very much, sorry I forgot to put the link in!
    I'll remember in the future.
    Thank you to both of you for your help!

  5. #5
    Join Date
    Aug 2004
    Posts
    10,138
    Thanks
    3
    Thanked 1,007 Times in 992 Posts
    Blog Entries
    16

    Default

    Hehe you're right jscheuer1. Now, should I feel stupid or upset at providing a solution to a non existent question?
    Last edited by ddadmin; 11-10-2005 at 10:36 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •