PDA

View Full Version : Time Delay for Imagetooltip



Mng026
05-04-2008, 01:18 AM
1) Script Title: Image w/ description tooltip

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/imagetooltip.htm

3) Describe problem: Does anyone know a good way to add a delay to the tool tip -- i.e as you rollover the link instead of opening instantly it takes..say 1 second. Thanks in advance,

Mike

Nile
05-04-2008, 09:11 PM
Find this chunk of code inside the script. (function: doTooltip()).


function doTooltip(evt,num) {
if (!tooltip) return;
if (t1) clearTimeout(t1); if (t2) clearTimeout(t2);
tipOn = true;
// set colors if included in messages array
if (messages[num][2]) var curBgColor = messages[num][2];
else curBgColor = tipBgColor;
if (messages[num][3]) var curFontColor = messages[num][3];
else curFontColor = tipFontColor;
if (ie4||ie5||ns5) {
var tip = startStr + messages[num][0] + midStr + '<span style="font-family:' + tipFontFamily + '; font-size:' + tipFontSize + '; color:' + curFontColor + ';">' + messages[num][1] + '</span>' + endStr;
tipcss.backgroundColor = curBgColor;
tooltip.innerHTML = tip;
}
if (!tipFollowMouse) positionTip(evt);
else t1=setTimeout("tipcss.visibility='visible'",50);
}
Above I highlighted something(find it). In the highlighted, you will see the number 50. This is the number of milliseconds before it opens, change the 50 to 1000 for 1 second.
Also, if you want to delay when it hides too.
Find this part in the code:


function hideTip() {
if (!tooltip) return;
t2=setTimeout("tipcss.visibility='hidden'",100);
tipOn = false;
}

Change the highlighted to 1000 for 1 second.

Mng026
05-05-2008, 01:04 AM
Works great. Also nice and easy. Can't thank you enough.

Mike

Nile
05-05-2008, 01:09 AM
Anytime. :)

Mng026
05-05-2008, 01:45 AM
Nile,
After a bit of testing, I increased the delay on mouseover to '750' milliseconds, works most of the time as intended, However, there is an occasional error where the pop-up will not restore - i.e remains frozen on the screen even after the mouse leaves the link.. any thoughts?

Mike

In addition -- If you have multiple links with a pop-up, and jump from one to the next, the pop up appears instantly regardless of the number you enter. Thanks for any suggestions.

Nile
05-07-2008, 01:55 AM
Can you please show me the website/url that this script is located? That would help me.

Mng026
05-07-2008, 02:39 PM
Gladly...
http://www.stonehouseproductions.com/tv.html

Much appreciated,

Mike

Nile
05-07-2008, 09:37 PM
It works fine for me... Hmm....

Mng026
05-08-2008, 12:31 AM
Hey Nile,
Thanks for looking into it for me. When you mouse over the first link it works perfectly... When you quickly jump to another thumbnail there is no longer a delay, but it switches instantly. Also occasionally when you mouse over a link and then use the scroll bar in the window the pop up will freeze in the middle of the screen. This only started happening when I increased the delay ?? Are you able to see it, or am I going crazy? Thanks a million,

Mike