YUI recommends YUI 3.

YUI 2 has been deprecated since 2011. This site acts as an archive for files and documentation.

Yahoo! UI Library

tabview  2.4.0

Yahoo! UI Library > tabview > YAHOO.widget.TabView

Show Private Show Protected

Class YAHOO.widget.TabView - extends YAHOO.util.Element

A widget to control tabbed views.

Constructor

YAHOO.widget.TabView ( el(optional) , attr )
Parameters:
el(optional) <HTMLElement | String | Object> The html element that represents the TabView, or the attribute object to use. An element will be created if none provided.
attr <Object> (optional) A key map of the tabView's initial attributes. Ignored if first arg is attributes object.

Properties

_contentParent - private HTMLElement

The container of the tabView's content elements.

_tabParent - private HTMLElement

The container of the tabView's label elements.

CLASSNAME - object

The className to add when building from scratch.
Default Value: "navset"

CONTENT_PARENT_CLASSNAME - object

The className of the HTMLElement containing the TabView's label elements to look for when building from existing markup, or to add when building from scratch. All childNodes of the content container are treated as content elements when building from existing markup.
Default Value: "nav-content"

TAB_PARENT_CLASSNAME - object

The className of the HTMLElement containing the TabView's tab elements to look for when building from existing markup, or to add when building from scratch. All childNodes of the tab container are treated as Tabs when building from existing markup.
Default Value: "nav"

Properties inherited from YAHOO.util.Element:

Properties inherited from YAHOO.util.AttributeProvider:

Methods

addTab

void addTab ( tab , index )
Adds a Tab to the TabView instance. If no index is specified, the tab is added to the end of the tab list.
Parameters:
tab <YAHOO.widget.Tab> A Tab instance to add.
index <Integer> The position to add the tab.
Returns: void
void

contentTransition

void contentTransition ( )
The transiton to use when switching between tabs.
Returns: void

DOMEventHandler

void DOMEventHandler ( e )
Routes childNode events.
Parameters:
e <event> The Dom event that is being handled.
Returns: void
void

getTab

void getTab ( index )
Returns the Tab instance at the specified index.
Parameters:
index <Integer> The position of the Tab.
Returns: void
YAHOO.widget.Tab

getTabIndex

void getTabIndex ( tab )
Returns the index of given tab.
Parameters:
tab <YAHOO.widget.Tab> The tab whose index will be returned.
Returns: void
int

initAttributes

void initAttributes ( attr )
setAttributeConfigs TabView specific properties.
Parameters:
attr <Object> Hash of initial attributes
Returns: void

initTabs

private void initTabs ( )
Creates Tab instances from a collection of HTMLElements.
Returns: void
void

removeTab

void removeTab ( item )
Removes the specified Tab from the TabView.
Parameters:
item <YAHOO.widget.Tab> The Tab instance to be removed.
Returns: void
void

toString

void toString ( )
Provides a readable name for the TabView instance.
Returns: void
String

Events

activeTabChange

activeTabChange ( )
Fires after the activeTab is changed.

See: Element.addListener

Event fields:
<String> type activeTabChange
<YAHOO.widget.Tab> prevValue the formerly active tab
<YAHOO.widget.Tab> newValue the new active tab

Usage:
var handler = function(e) {var previous = e.prevValue};
myTabs.addListener('activeTabChange', handler);


beforeActiveTabChange

beforeActiveTabChange ( )
Fires before the activeTab is changed.

See: Element.addListener

If handler returns false, the change will be cancelled, and the value will not be set.

Event fields:
<String> type beforeActiveTabChange
<YAHOO.widget.Tab> prevValue the currently active tab
<YAHOO.widget.Tab> newValue the tab to be made active

Usage:
var handler = function(e) {var previous = e.prevValue};
myTabs.addListener('beforeActiveTabChange', handler);


beforeOrientationChange

beforeOrientationChange ( )
Fires before the orientation is changed.

See: Element.addListener

If handler returns false, the change will be cancelled, and the value will not be set.

Event fields:
<String> type beforeOrientationChange
<String> prevValue the current orientation
<String> newValue the new orientation to be applied

Usage:
var handler = function(e) {var previous = e.prevValue};
myTabs.addListener('beforeOrientationChange', handler);


orientationChange

orientationChange ( )
Fires after the orientation is changed.

See: Element.addListener

Event fields:
<String> type orientationChange
<String> prevValue the former orientation
<String> newValue the new orientation

Usage:
var handler = function(e) {var previous = e.prevValue};
myTabs.addListener('orientationChange', handler);


Events inherited from YAHOO.util.Element:

Configuration Attributes

activeIndex - Int

The index of the tab currently active.

activeTab - YAHOO.widget.Tab

The tab currently active.

orientation - String

How the Tabs should be oriented relative to the TabView.
Default Value: "top"

tabs - Array

The Tabs belonging to the TabView instance.

Configuration attributes inherited from YAHOO.util.Element:


Copyright © 2007 Yahoo! Inc. All rights reserved.