InpageNavigation

InpageNavigation

new InpageNavigation(element, options)

Source:
Parameters:
Name Type Description
element HTMLElement

DOM element for component instantiation and scope

options Object
Properties
Name Type Description
stickySelector String

Selector for sticky inpage navigation element

containerSelector String

Selector for inpage navigation container element

inPageList String

Selector for inpage navigation list element

spySelector String

Selector for inpage navigation spied element

toggleSelector String

Selector for inpage navigation trigger element

linksSelector String

Selector for inpage navigation link element

spyActiveContainer String

Selector for inpage navigation container to spy on element

spyClass String

Selector to spy on

spyTrigger String
spyOffset Number
attachClickListener Boolean

Whether or not to bind click events

attachKeyListener Boolean

Whether or not to bind click events

attachResizeListener Boolean

Whether or not to bind resize events

attachScrollListener Boolean

Whether or not to bind scroll events

Classes

InpageNavigation

Methods

activateScrollSpy(event)

Description:
  • Activate scroll spy behaviors.

Source:
Parameters:
Name Type Description
event Event

closeList()

Description:
  • Close mobile list link.

Source:

deactivateScrollSpy()

Description:
  • Deactivate scroll spy behaviors.

Source:

destroy()

Description:
  • Destroy component instance.

Source:

destroyObserver()

Description:
  • Destroy observer.

Source:

destroyScrollSpy()

Description:
  • Destroy scroll spy behaviors.

Source:

destroySticky()

Description:
  • Destroy sticky behaviors.

Source:
Description:
  • Sets the necessary attributes to collapse inpage navigation list.

Source:
Parameters:
Name Type Description
e Event

handleClickOnToggler(e)

Description:
  • Invoke event listeners on toggle click.

Source:
Parameters:
Name Type Description
e Event

handleKeyboard(e)

Description:
  • Handle keyboard

Source:
Parameters:
Name Type Description
e Event

handleResize()

Description:
  • Trigger events on resize Uses a debounce, for performance

Source:

init()

Description:
  • Initialise component.

Source:

initObserver()

Description:
  • Initiate observer.

Source:

initScrollSpy()

Description:
  • Initiate scroll spy behaviors.

Source:

initSticky()

Description:
  • Initiate sticky behaviors.

Source:

on(eventName, callback) → {void}

Description:
  • Register a callback function for a specific event.

Source:
Example
// Registering a callback for the 'onToggle' event
inpage.on('onToggle', (event) => {
  console.log('Toggle event occurred!', event);
});
Parameters:
Name Type Description
eventName string

The name of the event to listen for.

callback function

The callback function to be invoked when the event occurs.

Returns:
Type
void

openList()

Description:
  • Open mobile list link.

Source:

setListHeight()

Description:
  • Calculate the available space for the dropwdown and set a max-height on the list

Source:

trigger(eventName, eventData)

Description:
  • Trigger a component event.

Source:
Parameters:
Name Type Description
eventName string

The name of the event to trigger.

eventData any

Data associated with the event.

update()

Description:
  • Update scroll spy instance.

Source:

(static) autoInit(root) → {InpageNavigation}

Source:
Parameters:
Name Type Description
root HTMLElement

DOM element for component instantiation and scope

Returns:

An instance of InpageNavigation.

Type
InpageNavigation

Events

onClick Triggered when an item is clicked

Description:
  • An array of supported events for this component.

Source:
Type:
  • Array.<string>