Jump to content

Tooltips _x and _y position


Elemental

Recommended Posts

Hey Folks, (I got myself involved in the following (http://www.soupkitcheninc.com), the people that started it are friends of mine and well, you know, you help when you can and even more so when it's for a good cause.)I was reading the reply to the post 'Mouseover Function' where justsomeguy referred the member to Walter Zorn, so I started playing with the tooltip scripts, very cool.I have a question regarding the positioning of the tooltip, I know that you can use the window and mouse _X and _Y coordinates but can you use the _X and _Y coordinates of a HTML tag, for instance <span id="blkbnsp">Black Bean Soup</span>?The idea is to have a tooltip for each SOUP NAME show the ingredients and nutritional facts on a

onmouseover event

, and the question came up, "can you place the tooltip at a fixed position (above and to the right or left of) the SOUP NAME the mouse pointer is over regardless of where the mouse pointer rolls over the tag?"So, can you?; and, if you can, where could I find an example of it?Peace,Elemental

Link to comment
Share on other sites

See http://www.quirksmode.org/js/findpos.html http://w3schools.com/css/css_positioning.asp and http://codepunk.hardwar.org.uk/css2js.htm and note that CSS properties are accessed via {element}.style.{property} in JavaScript.EDIT: And ask questions! (I don't know of an online example offhand, but I have done this before.)

Link to comment
Share on other sites

Jesdisciple, You couldn't make it simple could you? like, "here's an example based on your post" But nooooo I've got to go and read some more stuff... Thanks a lot!!!But seriously, all joking aside, Thanks for the reply; I appreciate it.I actually came across the quirksmode.org site once before, in passing, but never really looked at it, guess I will this time around; not quite sure about this, {element}.style.{property}, yet but I'm sure it'll run across in my learning's at some point Thanks again.Peace,Elemental

Link to comment
Share on other sites

If you're not going to be moving the element around, you can apply the CSS in a stylesheet and not mess with the JavaScript except to show/hide the tooltip. EDIT: Well, maybe not, since it needs to be positioned relative to another element whose position will be platform-dependent.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...