Class: TOCView

TOCView()

The Table of Contents View is a vertical navigation menu that links to other sections within the same view. The TOC can have 2 levels of content. The top level is referred to as 'topLevelItem'. Second level items are referred to as 'h2' (they come from 'h2' tags). H1s get passed in when the TOC view is instantiated (see `PortalSectionView.js` for an example). If there are 'h2' tags within the 'topLevelItem' containers, these will be listed under the 'topLevelItem'.

Constructor

new TOCView()

Source:

Methods

appendLink - Adds the generated link to both the desktop and mobile TOCs
Parameters:
Name Type Description
link HTMLLIElement The top-level item to add, including second-level UL if present
index number The index of the top-level item
Source:

onClose()

onClose - Close and destroy the view
Source:

renderScrollspy()

addScrollspy - Adds and refreshes bootstrap's scrollSpy functionality, and sets the listener to call this view's scrollSpyExtras when Bootstrap's "activate" event is called. This function should be called anytime the DOM is updated.
Source:

scrollSpyExtras(e)

scrollSpyExtras - Adds extra functionality to Bootstrap's scrollSpy function. This function is called anytime the "activate" event is called by bootstrap. For the desktop TOC, if activates the parent LI in the case that a second-level LI is active. For the mobile TOC, it changes text displayed in this.topLevelMobileToggle and this.secondLevelMobileToggle to the active top-level and second-level item, respectively. It also makes only the active second-level menu visible under the secondLevelMobile dropdown.
Parameters:
Name Type Description
e event The "activate" event triggered when an LI element is activated by bootstrap's ScrollSpy
Source:

setAffix()

Adds and refreshes bootstrap's affix functionality. This function should be called after the DOM has been rendered or updated. Renamed from postRender to avoid it being called automatically by Backbone.
Since:
  • 2.27.0
Source:

toggleDropdown(e)

toggleDropdown - Extends bootstrap's dropdown menu functionality by hiding the dropdown menu when the user clicks the dropdown toggle or any of the options within the dropdown menu.
Parameters:
Name Type Description
e event The click event on any part of the dropdown element
Source: