1.0.1 • Published 6 years ago

jquery-noti5 v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Noti5

jQuery notication plugin

Prerequisites

jQuery library

Installing

Options

DescriptionDefault
titleThe title of noti5
messageThe content of noti5
typeThe type of noti5, namely info, success, warn and dangerinfo
timeoutThe duration of noti5 in second4
posThe global position of the noti5. It includes top-left, top-center, top-right, bottom-left, bottom-center, and bottom-righttop-right
elementPosThe element position of the noti5: top, bottom, left or rightright
linkThe target link object container href, title and target when noti5 is being clicked{href: '#' title: '', target: '_blank'}
offsetThe offset of noti5. It takes either a single number or an object including x and y value0
spacingThe spacing between each noti5 containers5
showCloseBtnA boolean value to determine a close button is shown or nottrue

Default option overiew

{
    'title': '',
    'message': '',
    'type': 'info',
    'timeout': 4,
    'pos': 'top-right',
    'elementPos': 'right',
    'link': {
        'href': '#',
        'title': '',
        'target': '_blank'
    },
    'offset': 0, 
    // or
    // 'offset': {
    //   'x': 0,
    //   'y': 0
    //}
    'spacing': 5,
    'showCloseBtn': true
}

Usages

HTML:

<div class="foo"></div>

JavaScript:

$('.foo').noti5();

Pass a simple message

$('.foo').noti5("Lorem Ipsum");

Pass a custom setting

$('.foo').noti5({
	'title': 'Lorem Ipsum',
    'message': 'Lorem ipsum dolor sit amet, consectetur adipiscing elit',
	'type': 'info'
});

You can also initialize noti5 without a selector

$.noti5({
	'title': 'Lorem Ipsum',
    'message': 'Lorem ipsum dolor sit amet, consectetur adipiscing elit',
	'type': 'danger'
});

Methods

You can call the below methods with an noti5 instance

update(obj)

Only title, message, type and link can be updated.

var noti5 = $.noti5({
	'title': 'Lorem Ipsum',
    'message': 'Lorem ipsum dolor sit amet, consectetur adipiscing elit',
	'type': 'danger'
});

setTimeout(function(){
	noti5.update({
		'title': 'updated title',
		'message': 'updated message',
		'type': 'danger',
		'link': {
			'href': 'https://foo.com',
	 		'title': 'updated title',
	 		'target': '_blank'
		}
	});
}, 3000);

close()

var noti5 = $.noti5({
	'title': 'Lorem Ipsum',
    'message': 'Lorem ipsum dolor sit amet, consectetur adipiscing elit',
	'type': 'danger'
});

setTimeout(function(){
	noti5.close();
}, 3000);

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details