JAVASCRIPT
Closing utilities
All samples are using Ink.requireModules
, please read how to use it at Ink.requireModules section
Subscribes clicks on the document.body. Whenever an element with the classes ".ink-close" or ".ink-dismiss" is clicked, this module finds an ancestor ".ink-alert" or ".ink-alert-block" element and removes it from the DOM. This module should be created only once per page.
Method name | Description |
---|---|
new Close() | Constructor |
Example
<script>
Ink.requireModules(['Ink.UI.Close_1'],function( Close ){
new Close();
});
</script>
Initializing close
Demo
Click the X to close this!
Code
<div class="ink-alert basic" role="alert">
<button class="ink-dismiss">×</button>
<p>Click the X to close this!</p>
</div>
<script>
// Not needed with autoload.js
Ink.requireModules(['Ink.UI.Close_1'],function( Close ){
// Notice that the Close module doesn't take a selector as a parameter.
// This is because it is page-wide. You only need to call this once.
new Close();
});
</script>