Index of Official Examples

2007-09-05

Bubbling Library (YUI Extension): Index of Official Examples

Every control and plugin of the bubbling library ships with a series of examples that illustrate its implementation. These examples can serve as starting points for your exploration of the Bubbling Library, as code snippets to get you started in your own programming. Some of these examples use XHR request, which means that may not work if you don't use a webserver, you can see these examples directly in the official website.

Also, you can navigate through the API documentation in the official library website, and you will be able to explore these examples component-by-component; on this page you'll find the full index of library examples with a link to and short description of each one.

Core

Bubbling Core

Simple actions Untied your XHTML code from the javascript listeners, no more addListener in your code. Just define the class of each link, and the corresponding behavior for each link´s class.
Global behaviors In this example you will see how to define a global behavior called "actionGlobalBahavior", and every link or button in this page that have a className equal to "actionGlobalBahavior" will fire this behavior, even when the element is created form JavaScript or by another component in the page, even before or after the definition of the global behavior
Global behaviors - Advanced example In this example you will see a full explanation, step by step, of the possibilities of this technique, including dynamic behaviors (behaviors can be activated onDemand).
Defining behavior for keyboard shortcuts In this example you will see how to define keyboard shortcuts that will fire a certain behaviors.
Simple behavior to set the focus on form's elements Define links to set the focus in each field in a form.
Simple way to attach behaviors to menu items There is several ways to add a behavior to a certain YUI Menu Item, but there is a lot of factors that you need to keep in mind, specially for lazy menus (addListener on render, purgeElement on destroy, stopPropagation, etc). But there is a very simple way, using the bubbling technique. Each behavior will correspond with the "classname" defined for each element in the JS's Array, also can be applied directly in the XHTML in case you're using YUI Menu from markup.
Defining keyboard shorcuts for YUI Menus In this example you will see how to add keyboard shortcuts for menu items and submenus in a YUI Menu bar.
Dealing with floating elements (repainting the viewport) In this example you will see how to use the bubbling core to repaint certain elements when something change in the viewport using the "repaint" behaviors layer. The bubbling CORE will define a set of listeners to monitoring the browser (font size, scrolling, browser resize, etc), creating pipes to take certain actions.
Advanced rollover functionalities, expanding the CSS's boundaries In the another example, you will see how the "Lighter Plugin" can expand the CSS's boundaries. This plugin is based in one rollover behavior too, and apply certain className to DOM elements according to mouse movements.
Processing all the clicks on the page See how to use a global behavior to create a dynamic navigable website. All the clicks are wrapped by the global behavior, and certain actions will be fired, depending of the target of the event.

Plugins

Dispatcher

Dispatcher - General approach
Dynamically loading content with script inside This is an example of the DISPATCHER feature over two DIV tags, you can use the dispatcher to managing the content inside each DIV. This feature will warranty the execution of the scripts (remote and inline "script" tags) during the URI request.
Dispatcher for Tabview & external components
Delegate the loading mechanism for a TabView to the dispatcher to content with script inside This is an example of the DISPATCHER feature over the YUI tabview component, you can use the dispatcher to managing the content inside the tab. This feature will warranty the execution of the scripts (remote and inline "script" tags) during the dataSrc request.
TabView and Dispatcher Example - Dynamically loading content with child tabview inside This is an example of the DISPATCHER feature over the YUI tabview component, you can use the dispatcher to managing the "child tabview" inside each tab.
TabView, Datatable and Dispatcher Example - Dynamically loading content with datatable inside This is an example of the DISPATCHER feature over the YUI tabview component, you can use the dispatcher to managing the content inside the tab, and including another YUI component (YUI Datatable) during the dataSrc request.
TabView, Accordion and Dispatcher Example - Dynamically loading content with accordion inside This is an example of the DISPATCHER feature over the YUI tabview component, you can use the dispatcher to managing the content inside the tab, and including another tabview with accordion layout.
TabView and Dispatcher Example - Dynamically loading content with script inside This is an example of the DISPATCHER feature over the YUI tabview component, you can use the dispatcher to managing the content inside the tab. This feature will warranty the execution of the scripts (remote and inline "script" tags) during the dataSrc request.
Dispatcher for JavaScript and CSS injection
CSS Injection (cssLoader and applyCSS) In this example you will see how to inject CSS rules on demand in your application, the rules can be written in line or thru a remote file loaded thru AJAX using the YUI connection manager.
Loading YUI controls and widgets onDemand (jsLoader) In this case, you will see how to use the injection feature to load widgets onDemand (loading the required JS and CSS files with a logical orderly).
Dynamic Navigation Theory
Dynamically loading simple contents See how the left menu load the corresponding content in the central area of the page.
Dynamically loading content with YUI controls inside the area See how the left menu load the corresponding content in the central area of the page. In this example the main of the page also include external components that will be loaded onDemand (ex. Datatable and Tabview).
Combining the YUI MenuBar with the dispatcher See how the YUI MenuBar load the corresponding content in the central area of the page.
Advanced configuration options
How to pass parameters thru the dispatcher In this example, you will see how to pass parameters in the initialization process, and then use these parameters in the different moments during the loading process.
How to avoid memory leaks In this example, you can see how the first tab "Datatable Control" define the rules to destroy the YUI Datatable before change the content of the tab.
Dynamic content with inline scripts See how to process a HTML/JS code using the dispatcher.
Dynamic content with remote scripts (FULLPATH) Defining the path for the remote assets using the fullpath.

Tooltips & Helphint

ToolTips for every link in the page See how to use the mouseover/mouseout events to fire certain behaviors, getting as a result a nice dynamic "tooltips", even to dynamic elements created on the fly...
Dynamic ToolTips for different kind of elements (YUI Buttons, images, links) Dynamic ToolTips - This is a customization of the previous example, attaching tooltips to dynamic and static elements based on the title of the anchor.
HelpHints with images and links inside (flickr images and thumbnails) This is a tooltip customization to display thumbnail images on mouse over based on the HREF of the anchor. This implementation is based on the technique described by Chris Heilmann.
Animated and dragable ToolTips with "close" button and persistent (keeping one instance visible) You can use this control to display information related with the target element, and this information can be an common xhtml full text, allow you to use this control to keep this information visible until the user close the panel or rollover another element with tooltip attached. In this case the panel will be displayed using an animation effect (FADE In/Out).
AJAX ToolTips (Get the tooltip's content remotely) If you're using a lot of dynamic links, and every link has a custom text for the tooltip element, you can use a simple ajax application for fetch the content on the fly using the YUI Connection Manager.
ToolTips for different type of elements in the page using the className Include the corresponding behavior for Tooltips and a bunch of elements in your page will show a nice dynamic tooltip. All the elements with title and className equal to "yui-tip" will show a tooltip on rollover event. Also, learn how to extend the method "finder" to apply the dynamic tooltip to other kind of elements.

Lighter

Simple use of the lighter plugin - simple areas Use simples CSS rules to modify the look of the active area, including the opacity value...
Using the lighter plugin to create an accordion control animated (like the apple iPhone website) See how to use the important moments (onReset, onSelect) to apply certain behaviors to each area, including animations effects.
Slice control with a default opened section Learn how to initialize the accordion control (the first element is opened at the beginning), and the last selected item will remain opened too...
Using the lighter plugin to define different backgrounds for an area The important moments can offer a gateway for load or modify certain elements.

Wizard

PEAR Wizard using Javascript This example show you how to create and manage simple forms using the wizard plugin. In this case, using the PEAR:DBObject:Wizard in the backend...
Wizard plugin for a login forms In this example you will see how the wizard can adopt an area, and how it will manage the submition events for login thru the YUI connection manager.

Sound Manager

Simple actions (onClick, onRollover) Play sounds in your pages based on the classname of the elements.
Sound Manager + Accordion Menur The sound manager can be integrated with any YUI and YUI-CMS components.

Translator

Inline language definition - Simple example The language sentences can be defined inline in the header of the document. See how to switch between available languages.
Remote language definition - Advanced example See other examples to learn how to use the translator plugin to load different modules or loading onDemand when you need a language module.
Other examples You can see few widgets in this library that use the Translator plugin to manage the language's sentences. Click here to see how the translator plugin is used to load the remote language sentences to display the labels of the menu's options for the selected language.

Widgets

Accordion Control

These examples will show you how to create the correct HTML's markup and the CSS's rules to create expandable and collapsible areas.
Accordion Control (Expandable items)  
Vertical Accordion Menu  
Accordion Menu (action on rollover)  
AJAX Accordion Menu  
Accordion Menu + Sound Manager  
Hidden Left Panel  
Accordion Panels: Using Drag and Drop to reorder the items  
Accordion Panels  
Accordion Menu and how to handle it from outside  
Creating items on the fly for existing accordions (Injecting Elements)  
Nested Accordions Menus  

Loading Mask

Simple Loading Mask See how to use the "Loading Mask" in an overloaded webpage to avoid the quirks during the displaying process.
Animated Loading Mask The same loading mask but now with a fade In/Out animation.
Loading Mask: advanced example Every time you click on a dynamic link, the loading mask will be displayed and will be hiding at the loading process end (Integration with the YUI Connection Manager).

5 Comments

very nice library

i'm just browsing the examples and the bubbling library is ... really... COOL! :-)

Comment by mingfai - September 13, 2008

Dispatcher plugin rocks!

Thank you so much for the Dispatcher plugin! You saved my day. Put a donate link to your PayPal account so we can pay you when you save us countless hours.

Comment by Cody Burleson - September 18, 2008

RE: Dispatcher plugin rocks!

Thanks for the kind words. Donations are always welcome :-)

http://bubbling-library.com/eng/donations

There is a link on the top menu as well.

Comment by Caridy - September 18, 2008

how it works

Very cool stuff.

Will these examples working with a certain version of YUI or it just works on its alone?

Comment by syh - September 22, 2010

RE: how it works

Hey Syh,

Bubbling has been around for a while now (since 2.0.x if I remember correctly). And it should work in all the versions considering that it just uses a very stable subset of the YUI library.

Comment by Caridy - September 23, 2010
Bubbling for YUI 3.x

Dispatcher (gallery-dispatcher)
The Dispatcher satisfies a very common need of developers using the YUI library: dynamic execution of Ajax response content. (new)

Node Accordion (gallery-node-accordion)
The Accordion Node Plugin makes it easy to transform existing markup into an accordion element with expandable and collapsible elements. Elements are easy to customize, and only require a small set of dependencies. (new)

Event Binder (gallery-event-binder)
Binding user actions until a particular YUI instance become ready, and the listeners defined before flushing those events through a queue. This will help to catch some early user interactions due the on-demand nature of YUI 3. (new)

Preload (gallery-preload)
Port of Stoyan Stefanov's JavaScript preload() function. It also has built-in support for Timer Idle to preload files only when the user is idle to avoid any overhead during the initial loading process. (new)

Parent Window Utility (gallery-parent-window)
This utility provides a set of functionalities to interact with the parent window. (new)

- See more modules by Caridy.

Bubbling Library is free open source software under the BSD License

(c) 2006 - 2010 Caridy Patino. All Rights Reserved.

This is one of my side projects, if you need something, just ask!