ax5ui-toast
Version:
A toast plugin that works with Bootstrap & jQuery
148 lines (96 loc) • 2.33 kB
Markdown
> toast is a UI that can be used as an alternative means of window.alert, window.confirm and window.prompt
How to initialize the properties of the UI, there are two.
You can pass the property values of the UI to `setConfig`.
Using the `new` you can pass when you initialize the UI.
`setConfig([options, callInit=true])`
```js
var myToast = new ax5.ui.toast();
myToast.set_config({
msg: "String",
theme: "String",
width: "Number",
icon: "String",
closeIcon: "String",
onStateChanged: "Function",
displayTime: "Number",
animateTime: "Number",
containerPosition: "String",
lang: "Object"
});
```
**Easy Way - without setConfig**
```js
var myToast = new ax5.ui.toast({
msg: "String",
theme: "String",
width: "Number",
icon: "String",
closeIcon: "String",
onStateChanged: "Function",
displayTime: "Number",
animateTime: "Number",
containerPosition: "String",
lang: "Object"
});
```
Type: `String`
Title of toast.
Type: `String` [default: default]
Theme of toast, ax5toast themes using six colors defined by the bootstrap is provided.
Type: `Number` [default: 300]
Toast width
Type: `String`
Type: `String`
Type: `Function`
onStateChanged function is executed when the toast of the state is changed,
this.state state value is passed to this time onStateChanged function.
Type: `Number` [default : 3000]
Type: `Number` [default : 300]
Type: `String` [top-left|top-right|bottom-left|bottom-right]
Type: `Object`
```js
myToast.setConfig({
lang: {
"ok": "확인"
}
});
```
- - -
`push(String|Options[, callback])`
If this is String in the first argument and recognizes the first argument to `msg`.
it is possible to redefine all of the options that can be used in setConfig.
```js
toast.push('Toast message', function () {
console.log(this);
});
toast.push({
theme: 'danger',
msg:'Toast message'
}, function () {
console.log(this);
});
```
- - -
`confirm(String|Options[, callback])`
```js
confirmToast.confirm({
msg: 'Confirm message'
}, function(){
});
```
`close()`