Tuesday, December 12th, 2006

tooltip.js version 0.2

Category: JavaScript, Library

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:

javascript

  1. Event.observe(window,"load",function() {
  2.   $$("*").findAll(function(node){
  3.     return node.getAttribute('title');
  4.    }).each(function(node){
  5.      new Tooltip(node,node.title);
  6.      node.removeAttribute("title");
  7.    });
  8. });

Tooltip 0.2

Posted by Dion Almaer at 8:51 am
10 Comments

+++--
3.6 rating from 31 votes

10 Comments »

Comments feed TrackBack URI

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.

Comment by Dan Atkinson — December 12, 2006

Argh. Awful.

Comment by Dan Atkinson — December 12, 2006

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.

Comment by Michael — December 12, 2006

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.

Comment by jQuery enthousiast — December 12, 2006

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.

Comment by Mario — December 12, 2006

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.

Comment by Aaron Campos — December 12, 2006

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).

Comment by Mario — December 12, 2006

The code below can be simplified:

$$(“*”).findAll(function(node){
return node.getAttribute(‘title’);
})

to just

$$(“[title]”)

Comment by Les — December 13, 2006

@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 ;)

Comment by carter — December 15, 2006

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.

Comment by Mark — February 13, 2007

Leave a comment

You must be logged in to post a comment.