JS消息通知库:Oh Sna
Oh Snap! 是一个简单的jQuery/Zepto消息通知库,设计用于移动App上。
Installation
Download ohSnap.js:
- from Github
- with Bower:bower install oh-snap.
Add adiv.ohsnapwhich will contain the alerts :
<div id="ohsnap"></div>
Styling
Furthermore, ohSnap.js creates a div with classes.alert .alert-colorso you will want to have something like :
/* ALERTS */ /* inspired by 推ter Bootstrap */ .alert { padding: 15px; margin-bottom: 20px; border: 1px solid #eed3d7; border-radius: 4px; position: absolute; bottom: 0px; right: 21px; /* Each alert has its own width */ float: right; clear: right; } .alert-red { color: white; background-color: #DA4453; } .alert-green { color: white; background-color: #37BC9B; } .alert-blue { color: white; background-color: #4A89DC; } .alert-yellow { color: white; background-color: #F6BB42; } .alert-orange { color:white; background-color: #E9573F; }
Usage
To call a notification, useohSnap(text, color, icon). Examples :
ohSnap('Oh Snap! I cannot process your card...', 'red', 'icon-alert'); ohSnap('Yeeaahh! You are now registered.', 'green');
To remove a notification, useohSnapX().
Alerts are automatically bound to a click event (internally,ohSnapX()is called when the alert is clicked).
本文由用户 gww3 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!