Hoverable

Configs

12

A CSS class to add to the target element to enable CSS animations. This class is added after calling hoverEnter.

hoverCls: String

A CSS class to add to the target element.

hoverDelay: Number

The number of milliseconds to delay notification of changes in the hoverTarget.

hoverEdges: String

This property is a string containing one character for each edge that is hoverable. For example, a value of "tb" indicates that the top and bottom edges are hoverable.

hoverEdgeSize: Number= 10

When hoverEdges is used, this value determines the size (in pixels) of the edge. When the cursor is within this number of pixels of an edge listed in hoverEdges, the appropriate CSS class is added to the hoverTarget:

  • b-hover-top
  • b-hover-right
  • b-hover-bottom
  • b-hover-left

Depending on the values of hoverEdges, it is possible to have at most two of these classes present at any one time (when the cursor is in a corner).

hoverIgnoreElement: HTMLElement

An element to ignore. Mouse entry into this element will not trigger a change in either of the hoverElement or hoverTarget values.

A CSS class to add to the root element when there is an active target.

hoverRootCls: String

A CSS class to add to the root element.

hoverRootElement: HTMLElement

The outer element where hover tracking will operate (attach events to it and use as root limit when looking for ancestors).

A common choice for this will be document.body.

A selector for the closest API to determine the actual element of interest. This selector is used to process changes to the hoverElement to determine the hoverTarget.

hoverTarget: HTMLElement

The currently active hover target. This will be the same as hoverElement unless there is a hoverSelector.

hoverTrack: Boolean= false

Set to true to include tracking of mousemove events for the active hoverTarget. This is required for the hoverMove method to be called.

Properties

2
isHoverable: Boolean= truereadonly
Identifies an object as an instance of Hoverable class, or subclass thereof.
isHoverable: Boolean= truereadonlystatic
Identifies an object as an instance of Hoverable class, or subclass thereof.

Functions

4

This method is called when the cursor enters the hoverTarget. The hoverTarget will not be null.

ParameterTypeDescription
leavingHTMLElement

The element that was previously the hoverTarget. This value may be null.

This method should return true if the given element should be ignored. By default, this is true if the element is contained inside the hoverIgnoreElement.

ParameterTypeDescription
elementHTMLElement
Returns: Boolean

This method is called when the cursor leaves the hoverTarget. The hoverTarget may be null or refer to the new hoverTarget

ParameterTypeDescription
leavingHTMLElement

The element that was previously the hoverTarget. This value will not be null.

This method is called when the mouse moves within a hoverTarget, but only if enabled by the hoverTrack config.

ParameterTypeDescription
eventEvent