new Popover(element, options)
- Source:
Parameters:
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
element |
HTMLElement | DOM element for component instantiation and scope |
||||||||||||
options |
Object |
Properties
|
Classes
Members
(static) supportedEvents :Array.<string>
- Description:
An array of supported events for this component.
- Source:
An array of supported events for this component.
Type:
- Array.<string>
Methods
calculateAvailableSpace(toggleElement, scrollableParent)
- Description:
Calculate available space for the popover
- Source:
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
toggleElement |
Node | ||
scrollableParent |
Node |
null
|
checkPosition()
- Description:
Trigger events on resize Uses a debounce, for performance
- Source:
closePopover(e)
- Description:
Close the popover.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
e |
Event |
destroy()
- Description:
Destroy component.
- Source:
getClosestScrollableParent(element)
- Description:
Find the closest scrollable parent.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
element |
Node |
handleArrowPosition(direction)
- Description:
Reposition the arrow in case a push class is being used
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
direction |
string |
handleClickGlobal(e)
- Description:
Handles global click events, triggered outside of the popover.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
e |
Event |
handleClickOnToggle(e)
- Description:
Toggles between collapsed/expanded states.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
e |
Event |
handleKeyboardGlobal(e)
- Description:
Handles global keyboard events, triggered outside of the popover.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
e |
Event |
handlePushClass(direction)
- Description:
Check whether the popover is going out of its scrollable container and apply the needed repositioning.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
direction |
string |
init()
- Description:
Initialise component.
- Source:
on(eventName, callback) → {void}
- Description:
Register a callback function for a specific event.
- Source:
Example
// Registering a callback for the 'onOpen' event
popover.on('onOpen', (event) => {
console.log('Open 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
openPopover(e)
- Description:
Open the popover.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
e |
Event |
positionPopover()
- Description:
Manage popover position.
- Source:
resetStyles()
- Description:
Resets the popover selectors and styles.
- 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. |
(static) autoInit(root) → {Popover}
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
root |
HTMLElement | DOM element for component instantiation and scope |
Returns:
An instance of Popover.
- Type
- Popover
Events
onClose
- Source:
onOpen
- Source: