PDA

View Full Version : Resolved Stay on Top content script + delay + link



Luys
04-01-2011, 03:06 PM
1) Script Title: Stay on Top content script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/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! :confused:

Thanks in advance.

Luys

ddadmin
04-02-2011, 05:39 PM
To delay the initial display of a sticky note, you can wrap the initialization code for it in a setTimeout() function, for example:


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:


<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:


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

Luys
04-03-2011, 11:42 AM
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

Luys
04-03-2011, 03:08 PM
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