First things first, a special thanks.
notyfy is a fork of the wonderful noty jQuery plugin by Needim Arabacı. Special thanks to him for the original repo. See below for details on whats different from the original plugin.
Hi!
notyfy is a fork of the original noty jQuery plugin by Needim Arabacı, that makes it easy to create alert - success - error - warning - information - confirmation messages as an alternative the standard alert dialog. Each notification is added to a queue. (Optional). notyfy adds the ability to style notyfy via CSS, as well removing the need for JS-based layouts and implementing event-type callbacks.
The notifications can be positioned at the;
top - topLeft - topCenter - topRight - center - centerLeft - centerRight - bottom - bottomLeft - bottomCenter - bottomRight
There are lots of other options in the API to customise the text, animation, speed, buttons and much more.
It also has various events for the buttons, opening closing the notifications and queue control.
Layouts & Demos
Top
Alert
Success
Error
Warning
Information
Confirm
TopLeft
Alert
Success
Error
Warning
Information
Confirm
TopCenter
Alert
Success
Error
Warning
Information
Confirm
TopRight
Alert
Success
Error
Warning
Information
Confirm
CenterLeft
Alert
Success
Error
Warning
Information
Confirm
Center
Alert
Success
Error
Warning
Information
Confirm
CenterRight
Alert
Success
Error
Warning
Information
Confirm
BottomLeft
Alert
Success
Error
Warning
Information
Confirm
BottomCenter
Alert
Success
Error
Warning
Information
Confirm
BottomRight
Alert
Success
Error
Warning
Information
Confirm
Bottom
Alert
Success
Error
Warning
Information
Confirm
Installation
Include jQuery latest release in your header. The Google AJAX Libraries API can be used for this but you could also host the library yourself.Download notyfy from the Github and upload the files to your server.
Include jquery.notyfy.js and its dependancies below jQuery.Also add themes/default.css to your header. Or some other theme.
notyfy is compatible with jQuery 1.5+ for now.
Your code should then be similar to this:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script type="text/javascript" src="jquery.notyfy.js"></script>
<script type="text/javascript" src="jquery.notyfy.css"></script>
<script type="text/javascript" src="themes/default.css"></script>
Creating a notyfy
We wrote a helper for creating notyfy easily. So you can use notyfy(properties); Just like this;Returns a notyfy javascript object. (not jquery dom object, but you can access dom with this object)
var notyfy = notyfy({text: 'notyfy - Yet another jQuery notification plugin'});
Options & Defaults
Available options listed below.
$.notyfy.defaults = {
layout: 'top',
theme: 'default',
type: 'alert',
text: '',
dismissQueue: true, // If you want to use queue feature set this true
template: '<div class="notyfy_message"><span class="notyfy_text"></span><div class="notyfy_close"></div></div>',
showEffect: function(bar) { bar.animate({ height: 'toggle' }, 500, 'swing'); },
hideEffect: function(bar) { bar.animate({ height: 'toggle' }, 500, 'swing'); },
timeout: false, // delay for closing event. Set false for sticky notifications
force: false, // adds notification to the beginning of queue when set to true
modal: false,
closeWith: ['click'], // ['click', 'button', 'hover']
events: {
show: null,
hide: null,
shown: null,
hidden: null
},
buttons: false // an array of buttons
};
Custom Container
Just like this;
var notyfy = $('.custom_container').notyfy({text: 'notyfy - a jquery notification library!'});
Try!
Alert Success ErrorWarning Information Confirm
Custom Container
Theme (But How?)
notyfyCSS is easily themable using CSS. See the themes/default.css theme for details
After that you can set your new theme with notyfy theme property. Like;
var notyfy_id = notyfy({
text: 'notyfy - a jquery notification library!',
theme: 'your_new_theme',
});
API
$.notyfy.get(id) - Returns a notyfy javascript object
$.notyfy.close(id) - Close a notyfy - same as var n = notyfy({text: 'Hi!'})); n.close();
$.notyfy.clearQueue() - Clears the notification queue
$.notyfy.closeAll() - Close all notifications
$.notyfy.setText(id, text) - Notification text updater - same as var n = notyfy({text: 'Hi!'})); n.setText('Hi again!');
$.notyfy.setType(id, type) - Notification type updater - same as var n = notyfy({text: 'Hi!'})); n.setType('error');
Github Commit History
Committer | Message | Date |
---|---|---|
Loading... |