tabManager doesn't use any global variables or functions. An interference with other JavaScripts on your page is not impossible, but very unlikely.
Although tabManager is used like any other JS-tool on the web, examples often make it easier to understand what has to be done. They are also often seen as some qick reference.
/* * normal instantiation * a basePanel already exists and contains other divs to import as tabs */ var tm = new tabManager('basePanelID', true); /* * dynamic instantiation * a basePanel does not yet exist * hence no autoimport of panels within the basePanel can take place, so panel * _must_ be added dynamically */ var tm = new tabManager(); tm.addPanel(divObject, 'myTabTitle', ' my Tab'); /* * normal instantiation with tabBar below the panels * a basePanel already exists and contains other divs to import as tabs * tabBar will be added below the panels and stay the last child of basePanel */ var tm = new tabManager('basePanelID', true, true);
The main information page and the playground can be seen as live examples of how to use tabManager. Have a closer look at the source code an you will get around almost every functionality tabManager offers.
This API is intended for using tabManager, not for developing it. The following reference excludes private functions and variables. The code is documented inline an should be fairly easy to understand.
Add an eventHandler for the specified tabpanel, which gets executed when switching away from the tabpanel. The old eventHandler will be overwritten.
Add an eventHandler for the specified tabpanel, which gets executed when switching to the tabpanel. The old eventHandler will be overwritten.
Append a new panel to tabManager. Tab and navigational functionality is created automativally.
(int) tabID of new tabpanel, or -1 on error.
Disable the specified tabpanel. Switching to this panel will not be possible what so ever.
Enable the specified tabpanel. Switching to this panel will be possible again.
get DOM-object of basePanel
(obj) DOM-object of the basePanel
Determine tabID of the currently active tabpanel.
(int) tabManager's internal tabpanel ID
Determine tabID of the first tabpanel.
(int) tabManager's internal tabpanel ID
Determine tabID of the last tabpanel.
(int) tabManager's internal tabpanel ID
Determine tabID of the next tabpanel (relative to currently active tabpanel).
(int) tabManager's internal tabpanel ID
get DOM-object of panel-element
(obj) DOM-object of the panel
Determine tabID of the previous tabpanel (relative to currently active tabpanel).
(int) tabManager's internal tabpanel ID
get DOM-object of tab-element
(obj) DOM-object of the tab
Determine the tabManager's internal tabpanel ID of the dom-element with the specified element ID
(int) tabID, or -1 on failure
Determine the names of the tabs. Reads the name-attributes of the tabs NOT the innerHTML-attributes!
(array) tab names (index: tabID, value: tabName)
Determine if the secified tabpanel is disabled or not
(bool) true if disabled, false if enabled
Move a tabpanel to another position inside tabManager. Tab is moved to the in DOM-tree correct position, Links and ID are reorganised and updated. Jumps to first tabpanel if the tabpanel to remove is the currently active one. onSwitchTo-eventHandler will be executed after the tabpanel is moved.
(obj) removed panel, or false on error.
Remove a tabpanel from tabManager. Tab as well as panel will be removed from DOM-tree. Both Objects are destroyed.
(obj) removed panel, or false on error.
Set className of the basePanel-element
Set the accesskey of the tab-link of the specified tabpanel
Set innerHTML of tab-link
Set the title of the tab-link of the specified tabpanel
Set the name of the specified tabpanel. This will change the name-attribute NOT the innerHTML. See setTabLinkInnerHTML() for information on how to change the visual tabName.
Switch to the specified tabpanel. If the tabpanel to switch to is deaktivated, switching stops immediately. Before doing the actual switch the onSwitchFrom- and onSwitchTo-eventHandlers are executed. If one of the eventHandlers returns false, switching stops immediately.
Scans the contents of every tab for (anchor-)links beginning with #tmTab and adds switchTo()-functionality to the found links. You only need to call this function when you edit the contents of a tab outside tabManager. When adding removing or moving tabs using the tabManager-functions the links are updated automatically.
Copyright (c) 2006, Rodney Rehm.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.