I also made some improvements to the Filament Group’s tooltip script. The script already supports ARIA enabled tooltips. I added:
- An additional “tooltip-hidden” class on closed tooltips
- Support for tooltips added using AJAX in IE
- Keyboard access to tooltips
- Dynamic positioning of the tooltips
The dynamic positioning helps with displaying tooltips anywhere on the page. Previously they could run off the edge of the page if the tooltip was positioned too close to the edge. Now they default to the top-right corner of the trigger. If there’s not enough space on the page to the right, it will display to the left. Same thing with the top, where it flips to the bottom. You could end up with a tooltip in the top-right, top-left, bottom-left, or bottom-right. If the browser window is too small to fit any direction… well then you’re stuck.
You can find my changed version for download here.