PDA

View Full Version : Can an image be added to this tooltip script?



kalew
09-12-2006, 05:13 PM
1) Script Title:
Fixed Tooltip script

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex5/fixedtooltip.htm

3) Describe problem:
Is is possible to insert an image into the tooltips?
I know you have a script that does allow for images, but it interfers with my other scripts. I like the simplicity of this script, but I would like to add images. Thank you for you assistance.

jscheuer1
09-12-2006, 09:59 PM
Yes. The best way is to declare it as a variable in the script though:


var tip1='Hey, look at this Image:<br><img src="some.jpg"><br>Isn\'t it neat?'

This can go right before the </script> tag. You can use as many as you want, tip1, tip2, tip3, etc.

Then in your trigger code:


<a href="some.htm" onMouseover="fixedtooltip(tip1, this, event, '150px')" onMouseout="delayhidetip()">Link Text</a>

kalew
09-13-2006, 12:06 PM
Thanks John. Works great!! Appreciate all your assistance and scripts.

kalew
09-14-2006, 11:30 PM
Is it possible to add a clickable link inside this tooltip script? Thank you.

jscheuer1
09-15-2006, 02:58 AM
Well, of course, you can add a link anywhere you like to the variable for the tip, ex:


var tip1='Hey, look at this <a href="some.htm">Image</a>:<br><img src="some.jpg"><br>Isn\'t it neat?'

But, as soon as you try to move your mouse over the tip to use the link, it will very shortly thereafter disappear. To stop that from happening, alter this part of the code (add the red parts):


if (ie4||ns6)
document.write('<div id="fixedtipdiv" onmouseover="clearhidetip();" onmouseout="delayhidetip();" style="visibility:hidden;width:'+tipwidth+';background-color:'+tipbgcolor+'" ></div>')