Namespace: Interaction:setTappedState

Interaction:setTappedState

Methods

setTappedState(element, tappedClassopt, nullable, tappedDurationopt, nullable) → {Basic.Deferred}

Sets a "tapped" state on an element (via a CSS class), which removes itself again after a short time.

The sole reason for doing this, is to be able to apply styling to a tap/click action across devices without trailing styles, which would result by using something like :focus.

Parameters:
Name Type Attributes Default Description
element HTMLElement

the link to augment, has to be a node where we can set a "href" attribute

tappedClass String <optional>
<nullable>
'tapped'

the CSS class to set on the element to signify the "tapped" state

tappedDuration Number <optional>
<nullable>
200

the duration in milliseconds, the "tapped" state should last

Source:
Throws:

error if element is not an HTMLElement

Returns:
resolves with the element, when the tapped state ends
Type
Basic.Deferred
Example
setTappedState(link);
setTappedState(link, 'clicked', 500);