new DOMNavigator()
Adds the ability to navigate the DOM with the arrow keys
- Source:
Classes
Members
(static) DEFAULTS
The default options for the DOM navigator.
- Source:
Methods
destroy()
Destroy this navigator removing any event registered and any other data.
- Source:
disable()
Disable this navigator.
- Source:
elementsAfter(left, top) → {Array}
Return an array of navigable elements after an offset.
Parameters:
Name | Type | Description |
---|---|---|
left |
number | The left offset. |
top |
number | The top offset. |
- Source:
Returns:
An array of elements.
- Type
- Array
elementsBefore(left, top) → {Array}
Return an array of navigable elements before an offset.
Parameters:
Name | Type | Description |
---|---|---|
left |
number | The left offset. |
top |
number | The top offset. |
- Source:
Returns:
An array of elements.
- Type
- Array
enable()
Enable this navigator.
- Source:
getElements()
Find and store the navigable elements
- Source:
getNextElement(direction) → {HTMLElement}
Parameters:
Name | Type | Description |
---|---|---|
direction |
'down' | 'right' | 'left' | 'up' |
- Source:
Returns:
- Type
- HTMLElement
handleKeydown(event)
Handle the key down event.
Parameters:
Name | Type | Description |
---|---|---|
event |
Event | The event object. |
- Source:
inScrollContainerViewport(el) → {Boolean}
Indicate if an element is in the container viewport.
Parameters:
Name | Type | Description |
---|---|---|
el |
HTMLElement | The element to check. |
- Source:
Returns:
true if the given element is in the container viewport, otherwise false.
- Type
- Boolean
init()
Initialize the navigator.
- Source:
scrollTo(el, direction)
Scroll the container to an element.
Parameters:
Name | Type | Description |
---|---|---|
el |
HTMLElement | The destination element. |
direction |
String | The direction of the current navigation. |
- Source:
Returns:
void.
select(el, directionopt)
Select the given element.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
el |
Element | The DOM element to select. |
|
direction |
string |
<optional> |
The direction. |
- Source:
unselect()
Remove the current selection
- Source: