Tooltip

Tooltip

new Tooltip(element, options)

Source:
Parameters:
Name Type Description
element HTMLElement

DOM element for component instantiation and scope

options Object
Properties
Name Type Description
tooltipSelector String

Selector for tooltip triggers (uses data-ecl-tooltip or data-ecl-tooltip-inverted attribute, with optional title fallback)

attachHoverListener Boolean

Whether or not to bind hover events on tooltip triggers

attachResizeListener Boolean

Whether or not to bind resize events

attachScrollListener Boolean

Whether or not to bind scroll events

attachKeyListener Boolean

Whether or not to bind keyboard events

hideDelay Number

Delay in ms before hiding the tooltip when the mouse leaves, giving time to cross the gap between trigger and tooltip

Classes

Tooltip

Methods

clearHideTimeout()

Description:
  • Cancel a previously scheduled hide.

Source:

destroy()

Description:
  • Destroy component.

Source:

displayTooltip(trigger)

Description:
  • Display tooltip

Source:
Parameters:
Name Type Description
trigger HTMLElement

getOrCreatePopup(trigger) → {HTMLElement}

Description:
  • Return the popup element linked to a trigger, creating it if needed. This allows triggers added to the DOM after init() to work correctly.

Source:
Parameters:
Name Type Description
trigger HTMLElement
Returns:

popup

Type
HTMLElement

handleFocusIn(e)

Description:
  • Handle focusin event.

Source:
Parameters:
Name Type Description
e Event

handleFocusOut()

Description:
  • Handle focusout event.

Source:

handleKeyboardGlobal(e)

Description:
  • Handles global keyboard events, triggered outside of the tooltip.

Source:
Parameters:
Name Type Description
e Event

handleMouseOut(e)

Description:
  • Handle mouseout event.

Source:
Parameters:
Name Type Description
e Event

handleMouseOver(e)

Description:
  • Handle mouseover event (delegated).

Source:
Parameters:
Name Type Description
e Event

hideTooltip()

Description:
  • Hide tooltip

Source:

init()

Description:
  • Initialise component.

Source:

positionTooltip(trigger, popup)

Description:
  • Position tooltip relative to the trigger element.

Source:
Parameters:
Name Type Description
trigger HTMLElement
popup HTMLElement

scheduleHide()

Description:
  • Schedule a delayed hide, giving the mouse time to cross the gap between the trigger and the tooltip without closing it prematurely.

Source:

(static) autoInit(root) → {Tooltip}

Source:
Parameters:
Name Type Description
root HTMLElement

DOM element for component instantiation and scope

Returns:

An instance of Tooltip.

Type
Tooltip