Daemonite / Daemonite/material

Snackbar documentation doesn't include JS trigger instructions

Open
#238 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
CSS
Stars
3.2k
Forks
700
PR merge metrics
No merged PRs in 30d

Description

To add how to trigger snackbar with JS.
Adapted from `docs.min.js`. Code as such

```
//close snackbar on click
$(".snackbar-btn").on("click", function () {
$(this).parent(".snackbar").removeClass("show")
});

//show snackbar on click and auto hide at either after 6000ms or button is click again to show new snackbar
$(".snackbar-toggler").on("click", function () {
var e = $(this).next(".snackbar");
if ($(".snackbar.show").length > 0) {
$(".snackbar.show").removeClass("show").one("webkitTransitionEnd transitionEnd", function () {
e.addClass(function () {
setTimeout(function () {
e.removeClass("show")
}, 6e3);
return "show"
})
})
} else {
e.addClass(function () {
setTimeout(function () {
e.removeClass("show")
}, 6e3);
return "show"
})
}
});
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.