Tuesday, December 12th, 2006
tooltip.js version 0.2
Jonathan Weiss has released version 0.2. of his tooltip.js library:
The new version follows the mouse correctly on Firefox (thanks to Graham TerMarsch) and can apply a constant delta when displaying the tooltip. This can be useful if your CSS rules include absolute positioning that can result in a constant offset.
Another nice addition (by Xavier Lepaul) is the ability to create tooltips out of given text. Version 0.1 required you to give it the DOM id of a valid element. Version 0.2 will create a div with the class tooltip if it is given only text
Example
Creating tooltips from the title attributes automatically:
-
-
Event.observe(window,"load",function() {
-
$$("*").findAll(function(node){
-
return node.getAttribute('title');
-
}).each(function(node){
-
new Tooltip(node,node.title);
-
node.removeAttribute("title");
-
});
-
});
-













I’ll be honest and say that, for what it looks like and for the size of the library it runs on, it’s an aweful lot of code.
Argh. Awful.
I must say that I quite like the library and its size if you are already using Prototype.
Its pretty flexible and useful to me.
It is a shame that this website only announces news from prototype, YUI and Dojo, but not from jQuery. We send in news all the time but nothing gets placed.
I am kinda glad. I hate reading the jQuery cult posts… its not a religion its a framework. Its not a better idealogy. Its a framework. It wont solve world hunger. Its a js framework.
To me, any tooltip framework that does not incorporate the IE/IFRAME hack/fix (to ensure that the tooltip sites above select boxes in IE) is unusable. As such, this is unusable to me.
i tend to agree. there are several fixes out there. I use http://www.hedgerwow.com/360/bugs/css-select-free.html
with my tooltip script (i think its easier just to make your own tooltip script to fit your needs. most are bloated). I use Prototype to make mine but the entire site uses Prototype (compressed and only parts needed for each page).
The code below can be simplified:
$$(”*”).findAll(function(node){
return node.getAttribute(’title’);
})
to just
$$(”[title]“)
@Mario: Yes it is a js framework (or library, whatever you want to call it). A very good one.
The reason you people hate it is because it came along after prototype and after you already had dependencies on prototype. jQuery is awesome, but a lot of people won’t admit it because they think nothing should replace the almighty prototype. Gotta swallow that pride at some stage ;)
I like this with prototype, however, it doesn’t work so well in IE6 — the anchor point for the tooltip div is slightly off (by 150 pixels) from the mouse x,y. …it works beautifully in Firefox 1.5 and 2 though.