Close
Loading, please wait...
This announcement will hide in 60 seconds

YUI Widget: Tooltip Manager - Introduction

2007-03-04
RSS Channel bookmark this link

The most common technique for apply tooltips to the complete document is the use of "getElementByTagName", processing each tag and creating one instance of the ToolTips object attached to each tag. This pre-processing can freeze your browser, and create memory leaks when you are using dynamic areas. With the bubbling technique we can guarantee the success without worry about dynamic areas. Also we don´t need to refer a link directly using the tabName or an unique ID to create the corresponding tooltip object, decreasing the count of links with ID included inside the XTML code.

Besides, the implementation using the bubble RollOver only has an instance of the object of the tooltip for all the document, decreasing the memory use and generating each tooltip in real time through mouseover's event on any anchor.

We must include a few styles and scripts that are required to configure the tooltip's bubble. The initialization's example:

<!-- YUI Basement Style -->
<link rel="stylesheet" type="text/css" href='/yui/build/container/assets/container.css'/>
<!-- YUI scripts -->
<script type="text/javascript" src="/yui/build/yahoo/yahoo-min.js"></script>
<script type="text/javascript" src="/yui/build/event/event-min.js" ></script>
<script type="text/javascript" src="/yui/build/dom/dom-min.js" ></script>
<script type="text/javascript" src="/yui/build/container/container-min.js"></script>
<!-- YUI-CMS scripts -->
<script type="text/javascript" src='/yui-cms/build/bubbling/bubbling.js'></script>
<script type="text/javascript" src='/yui-cms/build/tooltips/tooltips.js'></script>

You can download this behavior, that include an singleton global object that will management this behavior, this object called "TooltipManager" ( YAHOO.widget.TooltipManager ) implement a few necessary optimizations for this behavior's good performance. Only include this behavior after the bubbling initialization and you will have all the tooltip's functionality in your page:

<script type="text/javascript" src='/yui-cms/build/tooltips/tooltips.js'></script>

Besides, we'll able to modify visually the style of the tooltipses through a simple code in CSS:

.yui-cms-tt .yui-panel {
text-align: left;
}
.yui-panel-container.yui-cms-tt.shadow .underlay {
top: 2px;
bottom: -2px;
right: -2px;
left: -2px;
padding-left: 4px;
}
.yui-cms-tt .yui-panel, .yui-cms-tt .yui-panel .bd {
color:#333;
background-color:#FDFFB4;
border-color:#FCC90D;
}
.yui-cms-tt .yui-panel .hd {
visible: hidden;
display: none;
}

You can see an example of this behavior through this link, this behavior includes several optimization techniques.

This implementation has only an instance of the tooltip object for the document, decreasing the memory usage and rendering in realtime each mouseover event.

No Comment yet

Latest Releases

Accordion Manager
This YUI Widget will allow you to create expandable and collapsible areas using the correct HTML and CSS, but without writing a single line of javascript code. (new)

Loading Mask
The Loading Mask widget will hide all the page's content until the onLoad's event, which mean that the website will not be displayed until the current page be fully loaded. Also this widget can be used in conjunction with the YUI Connection Manager to block the actions over the page until the AJAX's request finish. (new)

 
Hot Components

Accordion Manager
Create expandable and collapsible areas using the correct HTML and CSS, but without writing a single line of javascript code. (released)

Bubbling Core
The bubbling core now include a generic communication mechanism for widget2widget, widget2browser and widget2server messages. (updated lately)

Tooltip Manager
Improved, now using the YUI Overlay instead YUI Tooltips, also introduce a new feature, "content onDemand" using the YUI connection manager. (updated lately)

 
Coming Soon

Bubbling Library for YUI 3.x
A new version of the Bubbling Library compatible with the NEW YUI 3.x. (comming soon)

 
Recommended Reading

Using the YUI TabView Control with the Dispatcher Plugin
YUI Dispatcher Plugin and how to use it along with the YUI TabView to load on-demand content using the YUI Connection Manager.

The Bubbling Technique & Custom Event, YUI’s Secret Weapon
In this article I’ll share my experiences in the event-driven programming within the web browser and show how the Bubbling Library, combined with YUI’s Custom Event capabilities, can create an unobtrusive behavioral layer suitable for powerful web applications.

Event-Driven Web Application Design
I recommend you to read carefully the Christian Heilmann's paper, where he wrote about how to plan an Event-Driven application, and how this technique will become the future of the web application as a result of an evolutive process.

A JavaScript Module Pattern
Eric Miraglia's detailed explanation of how to use the closures and specifically the module pattern (singlenton) as a flexible and multi-funcional structure...

 
Related Links

Yahoo! UI Library (YUI)
YUI Official Website at the Yahoo! Developer Network.

YUI Official Forum
Get help and share your knowledges thru the frenetic javascript mailing list at Yahoo! Developer Network...

Motionbox EventHandler
For those who use propotype instead YUI, here is an implementation of the bubbling core routine for Propotype, I never tested it, but it's seen like a good implementation.

 
 
Linux MySql Server PHP Mozilla FireFox FireBug YAHOO! Bubbling Library
This website is XHTML 1.0 valid! This website can be browsing with all browsers! This website is valid for Level A of Web Accessibility!