View Full Version : balloon tip onload, once per session

06-22-2009, 08:40 AM
I am using script: http://www.dynamicdrive.com/dynamicindex5/balloontooltip.htm

Have it working great... But there are 2 things I would like to resolve/achieve, if someone could help me.

I am not really very advanced with scripting so if you can help, make it clear, thanks.

1) Have the tooltip appear on page load rather than mouseover

2) Have the tooltip only load the first time someone opens the page in a single session


06-22-2009, 03:16 PM
OK, on your page put this (highlighted) code after the balloon tip js external script tag (partially shown for reference, but not highlighted):

* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code

<script type="text/javascript">
var cookie = {
set:function(n, v, d){ //name value optional_persist_days
if(d){var dt=new Date();
d='; expires='+dt.toGMTString();}
document.cookie=n+'='+escape(v)+(d? d : '')+'; path=/';
get:function(n){ //name
var c=document.cookie.match('(^|;)\x20*'+n+'=([^;]*)');
return c? unescape(c[2]) : null;
kill:function(n){ //name
cookie.set(n, '', -1);
setTimeout("displayballoontip(document.getElementById('tip1'), {type:'mouseover'})", 0);
setTimeout(delayhidemenu, 1000);
cookie.set('tipShown', 'true');

In it I've colored red the two items you may wish to take note of. The first is a unique id you should assign to the tip trigger that you want to give this treatment to, ex:

<a id="tip1" href="http://www.dynamicdrive.com/style/" rel="balloon1">Dynamic Drive CSS Library</a>

It will now display onload, once per session. The other item is the delay before removing the tip. I've set it to 1 second (1000 milliseconds). You may want to increase it. The higher the number, the longer the tip will display onload. If the user mouses over and out of the tip's trigger it will disappear onmouseout.

06-23-2009, 08:21 AM
Thanks John... that really is magical!

06-24-2009, 04:16 AM
Hey John, any ideas on this one? http://www.dynamicdrive.com/forums/showthread.php?p=199521#post199521