PDA

View Full Version : Hey dhtml gurus


s3b
04-30-2008, 5:20 PM
What is it called when you hover your mouse over a link and a thumbnail pops up?

I'm trying to google tutorials but I don't know what to search

Spastic
04-30-2008, 5:29 PM
I'm pretty sure it's just called mouse over pop-up, or mouse over thumbnail.

Beefynick
04-30-2008, 6:52 PM
It is a mouseOver event. You can specify what happens on the event to whether you want a tooltip or an image.

Hunnter
05-01-2008, 6:25 AM
Just as they said, a simple mouse hovering event.

Just do that, create some hidden images somewhere (place at end of page before ending body, stops it interupting the flow if you turned off the CSS/Javascript, or for readers)
Then just position those images using the event.clientX & y to position it whenever hovering, or hide when you leave the image.

Axidos
05-02-2008, 1:35 AM
Here, have a precoded tooltip. You can change the appearance, too.
Not sure if you can put HTML (an image tag) in the tooltip text, I've never used this one, but go ahead and try.

http://www.freejavascriptkit.com/free_javascripts/tooltip_hint/dhtml_mouseover_tooltip.html

Hunnter
05-02-2008, 9:12 AM
Here, have a precoded tooltip. You can change the appearance, too.
Not sure if you can put HTML (an image tag) in the tooltip text, I've never used this one, but go ahead and try.

http://www.freejavascriptkit.com/free_javascripts/tooltip_hint/dhtml_mouseover_tooltip.html

That's actually a pretty decent one.
To make that one work with images(or any HTML at all actually), its just a slight fix to the code.

Replace:tipobj.innerHTML=thetext
with: tipobj.innerHTML=document.getElementById(thetext). innerHTML

Now you can specify another HTML element to be the actual tooltip, referencing it by ID.
Ex: <div id="tooltip1">this will be a tooltip</div>
Then in the onmouseover event, use the tooltip1 ID, rather than text.
The width thing can be rather annoying, auto-width would be better.

edit:
Since i am bored and remembered this, easy fix to get rid of fixed width issues.
Replace:
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
With:
tipobj.style.width="auto"
And then just remove the width from the function parameters and any calls to the function.
The width thing is a little broken anyway, well, when it comes to other fixed width objects (such as an image)