<div class="notify-example" id="example"></div>
<button id="notify" class="hx-btn hx-positive">Notify</button>
var exampleNotificationManager = new hx.NotificationManager('#example')
hx.select('#notify').on('click', function() {
exampleNotificationManager.notify('Clicked!')
})
.notify-example {
position:relative;
height: 50px;
width: 500px;
border:1px solid rgba(150,150,150,0.3);
margin: 0 auto;
background: rgba(150,150,150,0.1);
}
<div>
<button class="hx-btn hx-info" onclick="hx.notify.info('Info');">Info</button>
<button class="hx-btn hx-positive" onclick="hx.notify.positive('Positive');">Positive</button>
<button class="hx-btn hx-warning" onclick="hx.notify.warning('Warning');">Warning</button>
<button class="hx-btn hx-negative" onclick="hx.notify.negative('Negative');">Negative</button>
<button class="hx-btn" onclick="hx.notify.loading('Loading');">Loading</button>
<button class="hx-btn" onclick="hx.notify('Temporary');">Temporary</button>
<button class="hx-btn" onclick="hx.notify('Permanent', {timeout: undefined});">Permanent</button>
</div>
// show an info notification that will disappear after 5 seconds by default
hx.notify.info('Hello');
// show an info notification that will disappear after 20 seconds
hx.notify.info('Hello for longer', {timeout: 20});
// show a warning notification
hx.notify.warning('Something might be broken');
// show an negative notification
hx.notify.negative('Uh oh. Something went wrong');
// show a loading notification
loadingNotification = hx.notify.loading('Doing something...');
// hide the notification when the loading is complete
onLoadingThingFinished(function() {
loadingNotification.close();
});
hx.notify
functions, e.g. hx.notify('Message')
hx.notify.loading('Loading...')
info
method. // String
hx.notify('Message to display')
// Selection
message = hx.detached('div').text('Text to display')
hx.notify(message)
// HTMLElement
message = document.createElement('div')
message.appendChild(document.createTextNode('Text To Display'))
hx.notify(message)
renderer
must be provided in the options. var options = {
renderer: function (element, message) {
hx.select(element)
.add(hx.detached('div').text(message.header))
.add(hx.detached('div').text(message.body))
}
}
var message = {
header: 'Notification Header',
body: 'Notification Body'
}
hx.notify(message, options)
{
icon: 'fa fa-info',
cssclass: 'hx-info',
pinnable: true
}
undefined
by default. loading
method. // String
hx.notify('Message to display')
// Selection
message = hx.detached('div').text('Text to display')
hx.notify(message)
// HTMLElement
message = document.createElement('div')
message.appendChild(document.createTextNode('Text To Display'))
hx.notify(message)
renderer
must be provided in the options. var options = {
renderer: function (element, message) {
hx.select(element)
.add(hx.detached('div').text(message.header))
.add(hx.detached('div').text(message.body))
}
}
var message = {
header: 'Notification Header',
body: 'Notification Body'
}
hx.notify(message, options)
negative
method. // String
hx.notify('Message to display')
// Selection
message = hx.detached('div').text('Text to display')
hx.notify(message)
// HTMLElement
message = document.createElement('div')
message.appendChild(document.createTextNode('Text To Display'))
hx.notify(message)
renderer
must be provided in the options. var options = {
renderer: function (element, message) {
hx.select(element)
.add(hx.detached('div').text(message.header))
.add(hx.detached('div').text(message.body))
}
}
var message = {
header: 'Notification Header',
body: 'Notification Body'
}
hx.notify(message, options)
{
icon: 'fa fa-error',
cssclass: 'hx-negative',
pinnable: true
}
undefined
by default. notify
method. // String
hx.notify('Message to display')
// Selection
message = hx.detached('div').text('Text to display')
hx.notify(message)
// HTMLElement
message = document.createElement('div')
message.appendChild(document.createTextNode('Text To Display'))
hx.notify(message)
renderer
must be provided in the options. var options = {
renderer: function (element, message) {
hx.select(element)
.add(hx.detached('div').text(message.header))
.add(hx.detached('div').text(message.body))
}
}
var message = {
header: 'Notification Header',
body: 'Notification Body'
}
hx.notify(message, options)
undefined
by default. positive
method. // String
hx.notify('Message to display')
// Selection
message = hx.detached('div').text('Text to display')
hx.notify(message)
// HTMLElement
message = document.createElement('div')
message.appendChild(document.createTextNode('Text To Display'))
hx.notify(message)
renderer
must be provided in the options. var options = {
renderer: function (element, message) {
hx.select(element)
.add(hx.detached('div').text(message.header))
.add(hx.detached('div').text(message.body))
}
}
var message = {
header: 'Notification Header',
body: 'Notification Body'
}
hx.notify(message, options)
{
icon: 'fa fa-check',
cssclass: 'hx-positive',
pinnable: true
}
undefined
by default. warning
method. // String
hx.notify('Message to display')
// Selection
message = hx.detached('div').text('Text to display')
hx.notify(message)
// HTMLElement
message = document.createElement('div')
message.appendChild(document.createTextNode('Text To Display'))
hx.notify(message)
renderer
must be provided in the options. var options = {
renderer: function (element, message) {
hx.select(element)
.add(hx.detached('div').text(message.header))
.add(hx.detached('div').text(message.body))
}
}
var message = {
header: 'Notification Header',
body: 'Notification Body'
}
hx.notify(message, options)
{
icon: 'fa fa-warning',
cssclass: 'hx-warning',
pinnable: true
}
undefined
by default. hx.notifyDefaultTimeout
hx.notifyInfo
info
method. // String
hx.notify('Message to display')
// Selection
message = hx.detached('div').text('Text to display')
hx.notify(message)
// HTMLElement
message = document.createElement('div')
message.appendChild(document.createTextNode('Text To Display'))
hx.notify(message)
renderer
must be provided in the options. var options = {
renderer: function (element, message) {
hx.select(element)
.add(hx.detached('div').text(message.header))
.add(hx.detached('div').text(message.body))
}
}
var message = {
header: 'Notification Header',
body: 'Notification Body'
}
hx.notify(message, options)
{
icon: 'fa fa-info',
cssclass: 'hx-info',
pinnable: true
}
undefined
by default. hx.notifyLoading
loading
method. // String
hx.notify('Message to display')
// Selection
message = hx.detached('div').text('Text to display')
hx.notify(message)
// HTMLElement
message = document.createElement('div')
message.appendChild(document.createTextNode('Text To Display'))
hx.notify(message)
renderer
must be provided in the options. var options = {
renderer: function (element, message) {
hx.select(element)
.add(hx.detached('div').text(message.header))
.add(hx.detached('div').text(message.body))
}
}
var message = {
header: 'Notification Header',
body: 'Notification Body'
}
hx.notify(message, options)
hx.notifyNegative
negative
method. // String
hx.notify('Message to display')
// Selection
message = hx.detached('div').text('Text to display')
hx.notify(message)
// HTMLElement
message = document.createElement('div')
message.appendChild(document.createTextNode('Text To Display'))
hx.notify(message)
renderer
must be provided in the options. var options = {
renderer: function (element, message) {
hx.select(element)
.add(hx.detached('div').text(message.header))
.add(hx.detached('div').text(message.body))
}
}
var message = {
header: 'Notification Header',
body: 'Notification Body'
}
hx.notify(message, options)
{
icon: 'fa fa-error',
cssclass: 'hx-negative',
pinnable: true
}
undefined
by default. hx.notifyPositive
positive
method. // String
hx.notify('Message to display')
// Selection
message = hx.detached('div').text('Text to display')
hx.notify(message)
// HTMLElement
message = document.createElement('div')
message.appendChild(document.createTextNode('Text To Display'))
hx.notify(message)
renderer
must be provided in the options. var options = {
renderer: function (element, message) {
hx.select(element)
.add(hx.detached('div').text(message.header))
.add(hx.detached('div').text(message.body))
}
}
var message = {
header: 'Notification Header',
body: 'Notification Body'
}
hx.notify(message, options)
{
icon: 'fa fa-check',
cssclass: 'hx-positive',
pinnable: true
}
undefined
by default. hx.notifyWarning
warning
method. // String
hx.notify('Message to display')
// Selection
message = hx.detached('div').text('Text to display')
hx.notify(message)
// HTMLElement
message = document.createElement('div')
message.appendChild(document.createTextNode('Text To Display'))
hx.notify(message)
renderer
must be provided in the options. var options = {
renderer: function (element, message) {
hx.select(element)
.add(hx.detached('div').text(message.header))
.add(hx.detached('div').text(message.body))
}
}
var message = {
header: 'Notification Header',
body: 'Notification Body'
}
hx.notify(message, options)
{
icon: 'fa fa-warning',
cssclass: 'hx-warning',
pinnable: true
}
undefined
by default. notify
method. // String
hx.notify('Message to display')
// Selection
message = hx.detached('div').text('Text to display')
hx.notify(message)
// HTMLElement
message = document.createElement('div')
message.appendChild(document.createTextNode('Text To Display'))
hx.notify(message)
renderer
must be provided in the options. var options = {
renderer: function (element, message) {
hx.select(element)
.add(hx.detached('div').text(message.header))
.add(hx.detached('div').text(message.body))
}
}
var message = {
header: 'Notification Header',
body: 'Notification Body'
}
hx.notify(message, options)
undefined
by default. info
method. // String
hx.notify('Message to display')
// Selection
message = hx.detached('div').text('Text to display')
hx.notify(message)
// HTMLElement
message = document.createElement('div')
message.appendChild(document.createTextNode('Text To Display'))
hx.notify(message)
renderer
must be provided in the options. var options = {
renderer: function (element, message) {
hx.select(element)
.add(hx.detached('div').text(message.header))
.add(hx.detached('div').text(message.body))
}
}
var message = {
header: 'Notification Header',
body: 'Notification Body'
}
hx.notify(message, options)
{
icon: 'fa fa-info',
cssclass: 'hx-info',
pinnable: true
}
undefined
by default. loading
method. // String
hx.notify('Message to display')
// Selection
message = hx.detached('div').text('Text to display')
hx.notify(message)
// HTMLElement
message = document.createElement('div')
message.appendChild(document.createTextNode('Text To Display'))
hx.notify(message)
renderer
must be provided in the options. var options = {
renderer: function (element, message) {
hx.select(element)
.add(hx.detached('div').text(message.header))
.add(hx.detached('div').text(message.body))
}
}
var message = {
header: 'Notification Header',
body: 'Notification Body'
}
hx.notify(message, options)
negative
method. // String
hx.notify('Message to display')
// Selection
message = hx.detached('div').text('Text to display')
hx.notify(message)
// HTMLElement
message = document.createElement('div')
message.appendChild(document.createTextNode('Text To Display'))
hx.notify(message)
renderer
must be provided in the options. var options = {
renderer: function (element, message) {
hx.select(element)
.add(hx.detached('div').text(message.header))
.add(hx.detached('div').text(message.body))
}
}
var message = {
header: 'Notification Header',
body: 'Notification Body'
}
hx.notify(message, options)
{
icon: 'fa fa-error',
cssclass: 'hx-negative',
pinnable: true
}
undefined
by default. positive
method. // String
hx.notify('Message to display')
// Selection
message = hx.detached('div').text('Text to display')
hx.notify(message)
// HTMLElement
message = document.createElement('div')
message.appendChild(document.createTextNode('Text To Display'))
hx.notify(message)
renderer
must be provided in the options. var options = {
renderer: function (element, message) {
hx.select(element)
.add(hx.detached('div').text(message.header))
.add(hx.detached('div').text(message.body))
}
}
var message = {
header: 'Notification Header',
body: 'Notification Body'
}
hx.notify(message, options)
{
icon: 'fa fa-check',
cssclass: 'hx-positive',
pinnable: true
}
undefined
by default. warning
method. // String
hx.notify('Message to display')
// Selection
message = hx.detached('div').text('Text to display')
hx.notify(message)
// HTMLElement
message = document.createElement('div')
message.appendChild(document.createTextNode('Text To Display'))
hx.notify(message)
renderer
must be provided in the options. var options = {
renderer: function (element, message) {
hx.select(element)
.add(hx.detached('div').text(message.header))
.add(hx.detached('div').text(message.body))
}
}
var message = {
header: 'Notification Header',
body: 'Notification Body'
}
hx.notify(message, options)
{
icon: 'fa fa-warning',
cssclass: 'hx-warning',
pinnable: true
}
undefined
by default.