View Full Version : Sticky Tooltip Script Issue

03-17-2010, 11:15 PM
1) Script Title: Sticky Tooltip

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

3) Describe problem:
If the size of the box is too big to fit on the RIGHT of the mouse, it defaults to going to the LEFT of the mouse without regard to resizing, etc.

What this means:
I have a large text area that takes up about 80% of the horizontal screen space when hovered over (only 2-3 lines of vertical).
The item that is hovered over is about 25 pixels from the left side of the screen.
For some reason, the script thinks there is too much info to put to the right of the mouse, and puts it to the left (which is now 99% off the screen...)


03-18-2010, 01:42 AM
Are you asking how to force the script to always display to the right of the cursor, instead of to the left sometimes? If so, inside the .js file, try commenting out the below line (new addition in red):

//x=(x+tipw>$(document).scrollLeft()+$(window).width())? x-tipw-(stickytooltip.tooltipoffsets[0]*2) : x

03-18-2010, 02:54 PM
To the right would be a good temporary solution.
However, ideally there would be a little more logic in the script. Instead of assuming that if it can't fit on the right, to shove it to the left... Also checking to see if it can fit on the left. If it can't fit on the left, pick the side with the most area available and size the tooltip appropriately.

Alternatively (or additionally) it would be nice to set a "max" width of the tooltip. I would probably set a max width of 500px or so for my useage.