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

YUI Plugin: Lighter - Documentation

2007-05-26

Simple Use Case: YAHOO.plugin.Lighter

Markup (lighter container element):
<div class="hotarea1 yui-cms-selector">
  <div class="yui-cms-item">
      Hot item #1
  </div>
  <div class="yui-cms-item">
      Hot item #2
  </div>
</div>

Script:
YAHOO.plugin.Lighter.add( 'hotarea1' );
The Ligther Manager explore the areas with className "hotarea1" and highlight the items with className "yui-cms-item" on mouseover event.

Singleton: YAHOO.plugin.Lighter

YAHOO.plugin.Lighter.add(str className, obj config);

Arguments:
(1) className: className of the area (don't matter if the markup exist or no, the lighter is based on the "event-driven technique" to monitoring the hot areas).
(2) Configuration Object: JS object defining configuration properties for the area. See Configuration section for full list.

Solutions:

YAHOO.plugin.Lighter.add( "myhotareas", {
    persistent: false,
    onSelect: function ( element, area ) {
        alert ( 'Highlighting the element inside the area...');
    },
    onReset: function ( area ) {
        alert ( 'Removing the highlighting from all the elements inside this area.' );
    }
});

Leave the selected area highlighted:

Use the attribute "persistent" in the configuration to leave the last selected area highlighted when the mouse go out of this area.

Use the CSS rules to customize your lighter expirience:

#leftcolumn div.myhotarea.yui-cms-selector div.yui-cms-item {
  border: 1px solid #eeeeee;
  background-color: #ffffff;
  margin: 5px;
  padding: 5px;
}
#leftcolumn div.myhotarea.yui-cms-selector div.yui-cms-item.selected {
  border: 1px solid #333333;
  background-color: #cccccc;
}

The lighter add a new className "selected" to the item (yui-cms-item) when the mouse is over the element.

Key Interesting Moments in Lighter

Events Fires Arguments
onSelect ...on mouseover a highlightable item element [0] element: item DOM ref, [1] parent: area DOM ref
onReset ...when the lighter reset all items inside an area [0] parent: area DOM ref

Key Lighter Configuration Options

Option (type) Default Description
className (s) null The className of the explorable areas

Lighter DOM Structure

classname: yui-cms-selector
classname: yui-cms-item
content fo the element 1
classname: yui-cms-item
content fo the element 2

Facts

- Use the same className for several areas inside the document
- Use the onSelect and onReset events to create your our functionalities
- Use the CSS rules to create different behaviors for the same className


See the API Docs at full screen in a new window:

  http://www.bubbling-library.com/sandbox/api/index.hml

No Comment yet

News about Bubbling

Bubbling full API based on YUIDocs
Finally I got some time to review all the comments in the source code to generate the full API documentation based on YUI Docs, check the new documentation here. (new)

Accordion implementation to YUI 3.x
I spent some time creating a new plugin for YUI 3.x to implement the accordion features. Hopefully, this new plugin will be included within YUI 3.1 amoung other widgets and plugins. (hot)
- YUI3 Fork in github
- Check a preliminar example here

 
Follow Bubbling Library
 
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 knowledge thru the YUI Official Forum.

 
 
Linux MySql Server PHP Mozilla FireFox FireBug YAHOO! Bubbling Library