Menu

Dismiss

Adds a close-button to an element.

Example

Add the attribute yoi-dismiss to your element:

<!-- example -->
<div class="box p-4" yoi-dismiss>
    <p class="fs-2">You may dismiss me.</p>
</div>

Positioning: If the target’s element has neither position: absolute; nor position: relative;, the position will be set to relative. This might affect the element’s styling!

Events

This behavior fires the following events on each element it is applied to:

yoi-dismiss Fires after the dismissable element disappeared.

Source Files

behaviors/dismiss.js