new InpageNavigation(element, options)
- Source:
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
element | HTMLElement | DOM element for component instantiation and scope | ||||||||||||||||||||||||||||||||||||
options | Object | Properties
|
Classes
Methods
activateScrollSpy(event)
- Description:
Activate scroll spy behaviors.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
event | Event |
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:
handleClickOnLink(e)
- 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 |
handleEsc(e)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
e | Event |
handleShiftTab(e)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
e | Event |
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
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>