@buuug7/simplify-snackbar
v0.1.2
Published
simplify snackbar package
Downloads
7
Readme
simplify snackbar
Install
install @buuug7/simplify-snackbar
package via npm, and then import from @buuug7/simplify-snackbar/index.css
file.
npm install @buuug7/simplify-snackbar
Usage
<div class="snackbar" id="my-snackbar">
<span class="text">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</span>
<span class="close">x</span>
</div>
use javascript open and close
function showSnackbar() {
let el = document.querySelector('#my-snackbar');
el.classList.add('show');
// add event to hidden snackbar
el.querySelector('.close').addEventListener('click', () => {
el.classList.remove('show');
});
}