Results 1 to 4 of 4

Thread: Stay on Top content script + delay + link

  1. #1
    Join Date
    Jan 2011
    Posts
    51
    Thanks
    6
    Thanked 2 Times in 2 Posts

    Default Stay on Top content script + delay + link

    1) Script Title: Stay on Top content script

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici.../stayontop.htm

    3) Describe problem: Hi all! I want to delay a few seconds the initial display of the "ajaxdiv" at top right of the screen. Also, I try to be able to call again this content like in the links at the bottom of the page. Two related questions that I cannot solve myself: I try all possible combinations without success! Help!

    Thanks in advance.

    Luys
    Last edited by Luys; 04-03-2011 at 11:49 AM.

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

    Default

    To delay the initial display of a sticky note, you can wrap the initialization code for it in a setTimeout() function, for example:

    Code:
    setTimeout(function(){
    	alwaysOnTop.init({
    		targetid: 'examplediv',
    		orientation: 3,
    		position: [5, 10],
    		fadeduration: [1000, 1000],
    
    		hideafter: 15000
    	})
    }, 1000)
    The part in red is new, where 1000 denotes a 1 second delay.

    To relaunch a sticky note using a link for example, firstly, you'll want to cache the setting for it inside a JavaScript variable. Using the above example as an example, the below caches its settings:

    Code:
    <script type="text/javascript">
    
    var mysetting={
    		targetid: 'examplediv',
    		orientation: 3,
    		position: [5, 10],
    		fadeduration: [1000, 1000],
    
    		hideafter: 15000
    	}
    
    </script>
    Then to create a link that relaunches this sticky note, call alwaysOnTop.init() and pass in this setting variable:

    Code:
    <a href="javascript:alwaysOnTop.init(mysetting)">Launch sticky note</a>
    DD Admin

  3. #3
    Join Date
    Jan 2011
    Posts
    51
    Thanks
    6
    Thanked 2 Times in 2 Posts

    Default My sincere thanks

    The truth is that I played in one way or another to many of the items listed in the code for each of the questions that had arisen. But the solution is more complex and complete than I thought ...
    So at first glance everything seems so simple, and it is certainly due to the clarity and cleanliness in writing. No more.
    I have no words. Thousand thanks, ddadmin. I'm sure this can be also useful for many people.

    "Moltes grącies"

    Luys

  4. #4
    Join Date
    Jan 2011
    Posts
    51
    Thanks
    6
    Thanked 2 Times in 2 Posts

    Default So sorry: I made a mistake...

    Hi!
    "I'm very glad with this solution. However there is a small issue..."
    This is what I said not long ago and I've deleted as fast as I could.
    No problem at all:
    I made the mistake of assuming that it was again necessary to add a reference to the source when trying to adapt the code for the version with the id='ajaxdiv'.
    So do not add in any case the "externalsource" to the variable "var mysetting" : you could not close the ajax sticky note a second time.


    Thanks again and again.

    Luys
    Last edited by Luys; 04-03-2011 at 07:08 PM.

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
  •