Lightweight jQuery Notification Plugin ohSnap - Download Lightweight jQuery Notification Plugin - ohSnap

Download Lightweight jQuery Notification Plugin – ohSnap

Posted on

This time I will share jQuery Plugin and tutorial about Lightweight jQuery Notification Plugin – ohSnap, hope it will help you in programming stack.

Lightweight jQuery Notification Plugin ohSnap - Download Lightweight jQuery Notification Plugin - ohSnap
File Size: 13.1 KB
Views Total: 8052
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   



Oh Snap is a simple and lightweight jQuery plugin for easily creating different types of notifications in your websites or mobile apps. All the notification types and alert content can be easily customized in CSS and javascript.

How to use it:

1. Include a button to trigger the notification

1 <a class="button" id="red">Error</a>

2. The CSS for the notification

01 #ohsnap {
02 position: fixed;
03 bottom: 5px;
04 right: 5px;
05 margin-left: 5px;
06 z-index: 99;
07 }
08 .alert {
09 text-align: right;
10 margin-top: 10px;
11 padding: 15px;
12 border: 1px solid #eed3d7;
13 border-radius: 4px;
14 float: right;
15 clear: right;
16 }
17 .alert-red {
18 color: white;
19 background-color: #DA4453;
20 }

3. Include jQuery javascript library and jQuery Oh Snap plugin at the bottom of your page

1 <script src="//code.jquery.com/jquery-latest.min.js"></script>
2 <script src="ohsnap.js"></script>

4. Custom the alert text in the javascript

1 $('#red').on('click', function() { ohSnap('Oh Snap! You can't access this page!', {'color':'red'})});

5. Default options.

01 // color is  CSS class alert-color
02 'color'       : null,    
03  
04 // class of the icon to show before the alert text
05 'icon'        : null,    
06  
07 // duration of the notification in ms
08 'duration'    : '5000',  
09  
10 // id of the alert container
11 'container-id': 'ohsnap',
12  
13 // duration of the fade in/out of the alerts. fast, slow or integer in ms
14 'fade-duration': 'fast',

Change log:

2015-11-27

  • fixed bugs

2015-09-19

  • Fixed: Multiple Alerts not disappearing

2015-05-17

  • documented ohSnap and initialize icon-markup to empty string

This awesome jQuery plugin is developed by justindomingue. For more Advanced Usages, please check the demo page or visit the official website.




source : jqueryscript.net