Results 1 to 4 of 4

Thread: How can I make the Sticky Note Script a function?

  1. #1
    Join Date
    Nov 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How can I make the Sticky Note Script a function?

    The script in question is:
    http://www.dynamicdrive.com/dynamici...stickynote.htm

    As it is currently written, the script seems to happen everytime the page loads (at the DIV tag).

    Instead of the script running everytime on the page, I would like to know if there is anyway that I can make this script work only when called (maybe from a <a href="javascript.runStickNoteScriptFunction()">. For example, if a particular link on the page is clicked, the user then sees the stick note.

    Steve Clary

  2. #2
    Join Date
    Aug 2004
    Posts
    10,140
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Sure, simply comment this block of code inside the script:

    Code:
    /*
    if (displaymode=="oncepersession" && get_cookie("fadedin")=="" || displaymode=="always" || parseInt(displaymode)!=NaN && random_num==0){
    if (window.addEventListener)
    window.addEventListener("load", initfunction, false)
    else if (window.attachEvent)
    window.attachEvent("onload", initfunction)
    else if (document.getElementById)
    window.onload=initfunction
    document.cookie="fadedin=yes"
    }
    */
    Then, inside your HTML, use a link like this to activate the note:

    Code:
    <a href="javascript:initfunction()">Show sticky</a>

  3. #3
    Join Date
    Nov 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Please help explain what the DIV tags are doing....

    Great!
    I'm not familiar with DIV tags. I get feeling that the DIV tag (with the fadeinbox ID) is controlling the sticky note somehow. Am I bypassing any of that with this function effort?

    Can I still incorporate the funtionality from the DIV tags?
    Seems like the "Sticky Note" has a different size when I call it on my own.



    <div id="fadeinbox" style="filter:progid:DXImageTransform.Microsoft.RandomDissolve(duration=1) progid:DXImageTransform.Microsoft.Shadow(color=gray,direction=135) ; -moz-opacity:0">

    Also, what should I do with the
    <div align="right"><a href="#" onClick="hidefadebox();return false">Close</a></div>

    Do these tags still need to be in the page somewhere?

    Steve
    Last edited by ddadmin; 11-09-2005 at 09:25 PM.

  4. #4
    Join Date
    Aug 2004
    Posts
    10,140
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    The DIV tag is where your Sticky Content is contained inside, but the code changes I posted above don't touch this part, so I'm not 100% certain your question/ delima?

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
  •