Update: (02-12-2008) Multi-tag support has been added. Thanks go out to James Crooke for his lightweight code additions.
For the past few years I’ve been trying to perfect a technique of turning the title attribute into customizable, floating DIV’s. I’ve always known about NiceTitles and NicerTitles but there was something about those techniques that just didn’t jive with me (only works with
<a> tags, browser’s default title display still appears and overlaps or interferes with the pop up, extreme bloat, etc).
So I developed my own technique, and I call it qTip:
- Only 2K
- Removes title attribute on mouse over to eliminate overlaps
- Parses HTML in the titles
- Bloat free. It does what it says and nothing more
- Tested and works in IE 5.5+, Firefox, Safari, Opera
Open the qTip example page and download the qTip.js file. Edit the qTip.js file and modify the 3 lines near the top of the document. There are comments after each line that explain what each variable controls. It’s very intuitive but here’s a quick run down:
- qTipTag = the tags that you want to qTip-ize. Make sure to keep these variables lowercase and separate by a comma. It’s a good idea to choose tags that you use on your website and already have title attributes applied. If you use a CMS like TXP then the
<a>tag is a good choice.
- qTipX = change this number to move the generated pop up DIV along the x axis. This number can be positive or negative.
- qTipY = change this number to move the generated pop up DIV along the y axis. This number can be positive or negative.
Upload the qTip.js file somewhere on your server. In the
<head> tag of your web page use the following code making sure to change the src value so that it points to the correct location:
Now all we have to do is add a single rule to our CSS file. Here’s a simple example that will get you started:
border: 1px solid #666;
font: bold 9px Verdana, Arial, sans-serif;
You can modify this code to your liking.
Edit (11-05-2008): Also, please DO NOT contact me with support issues. This script is offered “as is”. It is not a bloated “be all end all” tip solution. The goal of this script is to offer a simple as-small-as-possible tip solution. Bloated feature requests will be ignored from now on.