Span |
---|
| Production Status: SNEAK PEEK | The Table of Contents component examines a page for HTML heading elements, and generates and formats a list of links to headings that can be used to navigate the page. It is used by the User Interface Options component. See Also Table of Contents Model Builder Table of Contents Levels User Interface Options API CreatorUse the following function to create a Table of Contents component:fluid.tableOfContents(container, options) Div |
---|
| Method | fluid.tableOfContents(container, options);
|
---|
Description | Instantiates a Table of Contents component applied to the specified container. |
---|
Parameters | container A CSS-based selectors, single-element jQuery object, or DOM element that identifies the root DOM node where the Table of Contents component should search for headings.
options An optional data structure that configures the Table of Contents component, as described below.
|
---|
Returns | The Table of Contents component |
---|
Examples | Code Block |
---|
| var toc = fluid.tableOfContents("#main"); |
|
---|
Notes | The Table of Contents only processes headings found inside the element provided by the container argument. This allows the component to be applied to only a section of a page, if desired. Keep in mind that the generated list of links will be placed inside the container , as specified by the tocContainer selector. |
---|
|
Supported Events Include Page |
---|
| _supported events intro |
---|
| _supported events intro |
---|
|
onReady Div |
---|
| Description | This event fires when the DOM is fully instantiated and ready to use. |
---|
Type | default |
---|
Parameters | The instantiated table of contents component
|
---|
Availability | Infusion 1.5 and later |
---|
|
onRefreshafterRender Div |
---|
| Description | This event fires Fires when the table of contents is rendered. |
---|
Type | default |
---|
Parameters | The Table of Contents Levels subcomponent |
---|
Availability | Infusion 1.5 and later |
---|
|
Methods Include Page |
---|
| _methods intro |
---|
| _methods intro |
---|
|
Div |
---|
| Description | Returns the information required for generating the anchor for the heading. |
---|
Parameters | heading The heading, usually one of headings generated by that.locate("headings") GUID The unique ID used to identify the generated anchor. |
---|
Configurable | yes Default implementation: "fluid.tableOfContents.headingTextToAnchorInfo" |
---|
Availability | Infusion v1.5 |
---|
See Also | generateGUID() |
---|
|
generateGUID()insertAnchor(name, element, anchorClass) Div |
---|
| Description | Used by the component to create and insert anchors before each element linked to by the table of contents. The default implementation creates an HTML <a> element using the name parameter as both the name and id of the element and applies anchorClass to the element. |
---|
Parameters | name The name used in the creation of the anchor.
element The element to insert the anchor before. anchorClass The css class to be applied to the anchor. |
---|
Configurable | yes Default implementation: "fluid.tableOfContents.insertAnchor" |
---|
Availability | Infusion v1.4 (note that the component signature changed in 1.5) |
---|
|
hide() Div |
---|
| Description | Hides the generated table of contents. |
---|
Parameters | none |
---|
Configurable | no |
---|
Availability | Infusion v1.0 |
---|
See also | show() |
---|
|
show() Div |
---|
| Description | Shows the generated table of contents. |
---|
Parameters | none |
---|
Configurable | no |
---|
Availability | Infusion v1.0 |
---|
See also | hide() |
---|
|
Options Include Page |
---|
| _options intro |
---|
| _options intro |
---|
|
selectors
Div |
---|
| Description | See below for details. |
---|
|
Selectors Include Page |
---|
| _selectors intro |
---|
| _selectors intro |
---|
|
The selectors supported by Table of Contents are described below. headings
Div |
---|
| Description | This selector will be used to identify all of the headings in the page. These headings will be used in the table of contents (after filtering). |
---|
Default | ":header:visible:not(.flc-toc-tocContainer :header)"
|
---|
Example | Code Block |
---|
| fluid.tableOfContents(".myContainer", {
selectors: {
headings: "h1,h2,h3" // limit to only three levels deep
}
});
|
|
---|
|
tocContainer
Div |
---|
| Description | This selector identifies the container into which the generated table of contents will be inserted. This will typically be an empty <div> element. |
---|
Default | ".flc-toc-tocContainer"
|
---|
Example | Code Block |
---|
| fluid.tableOfContents(".myContainer", {
selectors: {
tocContainer: "#tableOfContentsDiv"
}
});
|
|
---|
|
tocAnchors
Div |
---|
| Description | This selector identifies the generated table of contents anchors. These anchors are removed at every refresh before new anchors are added. |
---|
Default | ".flc-toc-anchors"
|
---|
Example | Code Block |
---|
| fluid.tableOfContents(".myContainer", {
selectors: {
tocAnchors: "#tableOfContentsAnchors"
}
});
|
|
---|
|
SubcomponentsSubcomponents can be configured though the parent component's components option using the following pattern: Code Block |
---|
| parent.component.name(".myContainer", {
components: {
<subcomponentName>: {
options: {
<subcomponent options>
}
}
}
});
|
levelsmodelBuilder |