spop.js是一款純js toast消息提示通知插件。通過spop.js插件,你可以快速的在網(wǎng)頁上制作出漂亮的toast消息提示效果。該js toast消息提示插件的特點(diǎn)還有:
使用方法在頁面中引入spop.css和spop.js文件。 <link rel='stylesheet' type='text/css' href='./css/spop.css'><script type='text/javascript' src='./js/spop.js'></script> 初始化toast該js toast消息提示插件最基本的使用方法如下: spop('Default SmallPop');spop('<h4 class='spop-title'>Success</h4>I′m a success SmallPop', 'success');spop('<strong>Warning pop</strong>', 'warning');spop('<strong>Error Here!</strong>', 'error'); 分組可以對消息進(jìn)行分組,分組后的消息每次只顯示一條。 spop({ template: 'All fields are required!', group: 'submit-satus', style: 'error'});spop({ template: 'Your information has been submitted', group: 'submit-satus', style: 'success' autoclose: 2000}); 回調(diào)函數(shù)在toast消息提示打開和關(guān)閉時(shí)都可以使用回調(diào)函數(shù)。 spop({ template: 'Please, close me.', onOpen: function () { document.body.style.background = '#fff'; }, onClose: function() { document.body.style.background = ''; spop({ template: 'Thank you!', style: 'success', autoclose: 2000 }); }}); 配置參數(shù)spop.js消息提示插件的可用配置參數(shù)如下: spop({ template : null,// string required. Without it nothing happens! style : 'info',// success, warning or error autoclose : false,// miliseconds position : 'top-right',// top-left top-center bottom-left bottom-center bottom-right icon : true,// or false group : false,// string, add a id reference onOpen : funtion() { }, onClose : funtion() { }});
Github地址為:https://github.com/silvio-r/spop |
|