An open API service indexing awesome lists of open source software.

https://github.com/steebchen/smackbar

a simple jquery notification library plugin
https://github.com/steebchen/smackbar

Last synced: 4 months ago
JSON representation

a simple jquery notification library plugin

Awesome Lists containing this project

README

          

# smackbar
a simple jquery notification library plugin

**DISCLAIMER: this library is still in development**

the name comes from the word snackbar which describes the message style from
Google's material design mixed with the project's only dependency
[smiler](https://github.com/steebchen/smiler) to transpile files

### setup

Method 1: CDN (**recommended**)

```html

```

Method 2: compile it by yourself (fully customizable)

```
git clone https://github.com/steebchen/smackbar && cd smackbar
npm i
npm start # compiles all files to the ./public/ directory. edit app.js to customize behavior
```

Method 3: get from npm

```
npm i smackbar
```

### usage

#### simple

This simple example shows a smackbar with a close button. It gets automatically
dismissed after 4 seconds.

```js
$.smackbar({
message: 'hi'
})
```

#### all options

```js
$.smackbar({
message: 'hi', // this is the only required field
timeout: 5000, // sepcify time in ms after the smackbar closes. set to false or 0 to disable
button: {
text: 'Undo', // the button text, will be transformed into uppercase automatically
preventClose: boolean, // TODO
onclick: function() {
console.log('clicked the button')
}
},
onclose: function() {
console.log('this function gets called when the smackbar gets closed')
}
})
```