PDA

View Full Version : Resolved 'Session' or not 'session'



Luys
06-01-2012, 10:06 AM
1) Script Title: Stay on Top content script

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

3) Describe problem:

First, the content is inside an external file and dynamically added to the page using Ajax.

In short: When the setting "frequency" is "session": Stay on Top pop-up window appears once per browser session. OK, This is what I need.

After closing the window (manually or by a countdown), there is the possibility to be re-opened by a text link, that is, a new variable. All is correct. I open and close the Stay on Top window at will... but only if I don't browse beyond this page. If I return, there is (obviously) not the automatic pop-up window BUT clicking on text link also has no effect at all.

Is there a workaround to set an effective frequency "always" to the text link variable?

Thanks in advance for your unvaluable help!

Luys

jscheuer1
06-02-2012, 05:14 AM
Not exactly. The problem is that once the cookie is set, the AJAX content isn't imported, so there's no way to show it. What we can do is import it if it's not there, then we can show it.

Put this script in the head of your page after the scripts for Stay on Top content:


<script type="text/javascript">
alwaysOnTop.showAgain = function(targetid){
var s = alwaysOnTop.settingscache[targetid], $t;
if(!($t = jQuery('#' + targetid)).size()){
alwaysOnTop.loadajaxcontent(jQuery, s);
} else {
alwaysOnTop.positiontarget($t, s);
}
alwaysOnTop.revealdiv(jQuery('#' + targetid), s);
};
</script>

Now you can have a link like so:


<a href="#" onclick="alwaysOnTop.showAgain('ajaxdiv'); return false;">Show BC</a>

where ajaxdiv is the targetid that was used to init the content.

Luys
06-02-2012, 08:45 AM
Only a few words, and the result is as if I had suddenly new graduated glasses: now I see everything much clearer. Very grateful for your help. Now I have a full solution without fringes.

Thank you, Dr. John, for your prescription lenses! ;-)

Luys