Pure JavaScript Toast & biblioteca emergente de diálogo-Alerty
| Autor: | undead25 |
|---|---|
| Views Total: | 3,619 |
| Sitio oficial: | Ir a la web |
| Actualizado: | August 8, 2016 |
| Licencia: | MIT |
Vista prévia
Descripción
Alerty es una biblioteca de JavaScript pequeña, fácil y libre de dependencia que le ayuda a crear material Design estilo de alerta/confirmación/diálogo emergente y notificaciones del sistema en la pantalla. Compatible con RequireJS y SeaJS.
Funcionamiento
Agregue los siguientes archivos requeridos a la página HTML.
<link rel="stylesheet" href="css/alerty.css"> <script src="js/alerty.js"></script>
Cree un cuadro de diálogo de alerta con el método Alerty. Alert.
// alerty.alert(content, opts, onOk)
alerty.alert('Alert Message', {
title: 'Info',
time: 3000
}, function(){alert('callback')}) Cree un diálogo de confirmación con el método Alerty. confirm.
// alerty.confirm(content, opts, onOk, onCancel)
alerty.confirm(
'Are you sure?',
{title: 'Notes', cancelLabel: 'Cancel', okLabel: 'Confirm'},
function(){
alerty.toasts('this is ok callback', {place: 'top'})
},
function() {
alerty.toasts('this is cancel callback')
}
) Cree un diálogo de solicitud con el método Alerty. prompt.
// alerty.prompt(content, opts, onOk, onCancel)
alerty.prompt('this is a prompt dialog',
{inputType: 'text', inputPlaceholder: 'fill the blank', inputValue: 'default value'},
function(value){
alerty.alert('value you typed is: <b>'+value+'</b>')
}, function(){alert('cancel callback')}) Cree un mensaje de notificación de estilo Toast mediante el método Alerty. toasts.
// alerty.toasts(content, opts, callback)
alerty.toasts('Toast Message', {
bgColor: '#ccc',
fontColor: '#000'
}, function(){alert('toasts callback')})





