Bootstrap Notify
Turn standard bootstrap alerts into "growl" like notifications from Bootstrap Notify
Table of Content
Examples
Basic Notify
$.notify({
// options
message: 'Hello World'
},{
// settings
type: 'danger'
});
Full List Of Options/Settings
$.notify({
// options
icon: 'icon-bell',
title: 'Bootstrap notify',
message: 'Turning standard Bootstrap alerts into "notify" like notifications',
url: 'https://github.com/mouse0270/bootstrap-notify',
target: '_blank'
},{
// settings
element: 'body',
position: null,
type: "info",
allow_dismiss: true,
newest_on_top: false,
showProgressbar: false,
placement: {
from: "top",
align: "right"
},
offset: 20,
spacing: 10,
z_index: 1031,
delay: 5000,
timer: 1000,
url_target: '_blank',
mouse_over: null,
animate: {
enter: 'animated fadeInDown',
exit: 'animated fadeOutUp'
},
onShow: null,
onShown: null,
onClose: null,
onClosed: null,
icon_type: 'class',
template: ''
});
Options
Name | Type / Values | Required | Description |
---|---|---|---|
icon | class | src | No |
This is the icon that will be displayed within the notify notification. This icon can either be a class (Font Icon) or an image url. Please keep in mind if you wish to use an image url that you must set icon_type to img in the options. |
title | string | No |
This is the title that will be displayed within the notify notification. Please keep in mind unless you style the [data-notify="title"] in css this will look identical to the message. |
message | string | Yes |
This is the message that will be displayed within the notify notification. |
url | web address | No |
If this value is set it will make the entire notify (except the close button) a clickable area. If the user clicks on this area it will take them to the url specified here. |
target | _blank | _self | _parent | _top | no |
The target attribute specifies where to open the linked notification. |
Settings
Name | Type / Values | Default | Description |
---|---|---|---|
element | string | body |
Appends the notification to a specific element. If the element is set to anything other than the body of a document it switches from a position: fixed to position: absolute. |
position |
static | fixed | relative | absolute |
null
|
null |
Allows users to specify a custom position to the notification container element. |
type | string | info |
Defines the style of the notification using bootstraps native alert
styles. Please keep in mind that when the notification is generated the
type gets prefixed with alert-. When using native alert styles this will
not be an issue, but if you create a new style such as pink when setting
up the css you have to use the class alert-pink .
|
allow_dismiss | boolean | true |
If this value is set to false it will hide the
data-grow="dismiss" element. Please keep in mind if you
modify the template setting and do not include a
data-notify="dismiss" element even with this set to true
there will be no element for a user to click to close the notification.
|
showProgressbar | boolean | false |
This boolean is used to determine if the notification should
display a progress bar.
|
placement.from | string | top |
This controls where if the notification will be placed at the
top or bottom of your element.
|
placement.align | string | right |
This controls if the notification will be placed in the left ,
center or right side of the element.
|
offset | integer | 20 |
This adds padding in pixels between the element and the
notification creating a space between their edges.
|
offset.x | integer | 20 |
This adds adding on the x axis in pixels between
the element and the notification creating a space between their edges.
|
offset.y | integer | 20 |
This adds padding on the y axis in
pixels between the element and the notification creating a
space between their edges.
|
spacing | integer | 10 |
This adds a padding in pixels between notifications with the
same placement creating a space between their edges.
|
z_index | integer | 1031 |
Pretty simple, this sets the css property z-index for the
notification. You may have to raise this number if you have other elements
overlapping the notification.
|
delay | integer | 5000 |
If delay is set higher than 0 then the
notification will auto-close after the delay period is up.
Please keep in mind that delay uses milliseconds so 5000 is
5 seconds.
|
timer | integer | 1000 |
This is the amount of milliseconds removed from the notify at every
timer milliseconds. So to make that a little less confusing
every 1000 milliseconds there will be
1000 milliseconds removed from the remaining time of the
notify delay. If this is set higher then delay the notify will not be
removed until timer has run out.
|
url_target | _blank | _self | _parent | _top | '_blank' |
This sets the target of the url for a notification. please check
HTML <a> target Attribute to learn more about these
options.
|
mouse_over |
pause | null
|
null |
By default this does nothing. If you set this option to pause it will
pause the timer on the notification delay. Since version
2.0.0 the timer will not reset it will continue from it's last tick.
|
animate.enter | string | animated fadeInDown |
This will control the animation used to bring the generate the notification on screen. Since version 2.0.0 all animations are controlled using css. This plugin is not com packaged with any animations. Please use Animate.css by Daniel Eden or you can always write your own css animations. |
animate.exit | string | animated fadeOutUp |
This will control the animation used to bring the generate the notification on screen. Since version 2.0.0 all animations are controlled using css. This plugin is not com packaged with any animations. Please use Animate.css by Daniel Eden or you can always write your own css animations. |
onShow | function | null |
This event fires immediately when the show instance method is
called.
|
onShow | function | null |
This event is fired when the modal has been made visible to the user (will wait for CSS transitions to complete). |
onClose | function | null |
This event is fired immediately when the notification is
closing .
|
onClosed | function | null |
his event is fired when the modal has finished closing and is removed from the document (will wait for CSS transitions to complete). |
icon_type | string | class |
This is used to let the plugin know if you are using an
icon font for images or if you are using image .
If this setting is not set to class it will assume you are
using an img . Please keep in mind if you are using an
image you to set icon to the src of
the image .
|
template | HTML | code below |
Since version 3.0.0 the template option has been revamped in hopes of giving users more control over the layout. Please find the code for the default template below. |