Thursday, September 8, 2011

Tooltip Class. Prototype

One of my projects was developed on prototype java-script framework. I needed to write a functionality to show tool tip . I started to look in the prototype framework if they already have it.
Unfortunately I did not find any component . I started to goggle it  and did not found anything as well.So I wrote my class that aimed to show tool tip . In constructor class receiving following parameters.

elementOb -  The parent element to show tip
tool_tip -  Tool tip message
width - Tooltip width
height - Tooltip height

Simple?

In order to setup a css class for the tool tip need to define a css style with the
.toolTip className.

To use it need to write the code below.

var toolTipMessage = "The message is showing tooltip.Please change and play with it";
var toolTip = new Tooltip($('tblToolTip'),toolTipMessage);
I wrote sample page to test it .

All the code can be downloaded from here Download


See below sample picture



No comments:

Post a Comment