Interactions
Normalizes the hover event across different browsers and devices.
Import the Hover primitive from ng-primitives/interactions
.
import { NgpHover } from 'ng-primitives/interactions';
Assemble the hover directives in your template.
<div
(ngpHover)="onHoverChange($event)"
(ngpHoverStart)="onHoverStart()"
(ngpHoverEnd)="onHoverEnd()"
></div>
The following directives are available to import from the ng-primitives/interactions
package:
[ngpHover]
ngpHover
Apply the ngpHover
directive to an element that you want to listen for hover events. This is particulaly useful for supporting hover events on touch devices, where hover events are not handled consistently. On iOS relying on the :hover
pseudo-class can result in the hover state being stuck until the user taps elsewhere on the screen.
Attribute | Description |
---|---|
data-hover |
Added to the element when hovering occurs. |
Copyright © 2024 Angular Primitives