My extended tooltip script allows you to create tooltip content using HTML that is far in advance of what you get using the title attribute. The script works well for the typical web page that doesn't need to be scrolled horizontally and where the page can be scrolled down if the tooltip extends too far down.
That version of the script leaves out the additional code that is needed to allow for pages that can be scrolled horizontally as well as the code needed to reposition tooltips that will not fit below the element to which they are attached where the page can't be scrolled vertically. The reason why those pieces of code were omitted is that they add significantly to the length of the script and they are rarely needed.
Now I have another version of the script that does take these additional factors into account and which can therefore be used to position tooltips on any web page regardless of which direction(s) the page can be scrolled. For most web sites my original script will be quite adequate but if you do need to handle horizontal scrolling of pages then the enhanced version is now included in the tooltip script download along with the basic version. Just select the tooltipe.js file instead of the tooltip.js file and rename it to remove the 'e' and use it the same way as described for the original script.
I have set up an example tooltip web page with both vertical and horizontal scrolling with several tooltips positioned where you can easily see how the tips position themselves differently depending on where the link is relative to the visible area within the page.
This article written by Stephen Chapman, Felgall Pty Ltd.