Dismiss

‹ Back

Automatically dismiss elements by adding data-dismiss to the element.

This will disappear after 10 seconds. (default)
This will disappear after 20 seconds.
This will disappear after 2 seconds.
<div data-dismiss>
  This will disappear after 10 seconds. (default)
</div>
<div data-dismiss="20">
  This will disappear after 20 seconds.
</div>
<div data-dismiss="2">
  This will disappear after 2 seconds.
</div>

Events

There are two events fired on the dismissed elements that you can listen for:

  • element.addEventListener("ornement:dismiss:started", function(){}) - element has started counting down
  • element.addEventListener("ornement:dismiss:dismissed", function(){}) - element has been dismissed