bootalert is a Javascript library for non-blocking notifications. jQuery is required. The goal is to create a simple core library that can be customized and extended. based on toastr Modify
Build Status Browser testing provided by BrowserStack.
Install-Package bootalert
bower install bootalert
npm install --save bootalert
# Gemfile
gem 'bootalert- '
# application.coffee
#= require bootalert
// application.scss
@import "bootalert";
The following animations options have been deprecated and should be replaced:
- Replace
options.fadeIn
withoptions.showDuration
- Replace
options.onFadeIn
withoptions.onShown
- Replace
options.fadeOut
withoptions.hideDuration
- Replace
options.onFadeOut
withoptions.onHidden
-
Link to bootalert.css
<link href="bootalert.css" rel="stylesheet"/>
-
Link to bootalert.js
<script src="bootalert.js"></script>
-
use bootalert to display a bootalert for info, success, warning or error
// Display an info bootalert with no title bootalert.info('Are you the 6 fingered man?')
// Display a warning bootalert, with no title
bootalert.warning('My name is Inigo Montoya. You killed my father, prepare to die!')
// Display a success bootalert, with a title
bootalert.success('Have fun storming the castle!', 'Miracle Max Says')
// Display an error bootalert, with a title
bootalert.error('I do not think that word means what you think it means.', 'Inconceivable!')
// Immediately remove current bootalerts without using animation
bootalert.remove()
// Remove current bootalerts using animation
bootalert.clear()
// Override global options
bootalert.success('We do have the Kapua suite available.', 'Turtle Bay Resort', {timeOut: 5000})
In case you want to escape HTML characters in title and message
bootalert.options.escapeHtml = true;
Optionally enable a close button
bootalert.options.closeButton = true;
Optionally override the close button's HTML.
bootalert.options.closeHtml = '<button><i class="icon-off"></i></button>';
You can also override the CSS/LESS for #bootalert-container .bootalert-close-button
Optionally override the hide animation when the close button is clicked (falls back to hide configuration).
bootalert.options.closeMethod = 'fadeOut';
bootalert.options.closeDuration = 300;
bootalert.options.closeEasing = 'swing';
Show newest bootalert at bottom (top is default)
bootalert.options.newestOnTop = false;
// Define a callback for when the bootalert is shown/hidden/clicked
bootalert.options.onShown = function() { console.log('hello'); }
bootalert.options.onHidden = function() { console.log('goodbye'); }
bootalert.options.onclick = function() { console.log('clicked'); }
bootalert.options.onCloseClick = function() { console.log('close button clicked'); }
bootalert will supply default animations, so you do not have to provide any of these settings. However you have the option to override the animations if you like.
Optionally override the animation easing to show or hide the bootalerts. Default is swing. swing and linear are built into jQuery.
bootalert.options.showEasing = 'swing';
bootalert.options.hideEasing = 'linear';
bootalert.options.closeEasing = 'linear';
Using the jQuery Easing plugin (http://www.gsgd.co.uk/sandbox/jquery/easing/)
bootalert.options.showEasing = 'easeOutBounce';
bootalert.options.hideEasing = 'easeInBack';
bootalert.options.closeEasing = 'easeInBack';
Use the jQuery show/hide method of your choice. These default to fadeIn/fadeOut. The methods fadeIn/fadeOut, slideDown/slideUp, and show/hide are built into jQuery.
bootalert.options.showMethod = 'slideDown';
bootalert.options.hideMethod = 'slideUp';
bootalert.options.closeMethod = 'slideUp';
Rather than having identical bootalerts stack, set the preventDuplicates property to true. Duplicates are matched to the previous bootalert based on their message content.
bootalert.options.preventDuplicates = true;
Control how bootalert interacts with users by setting timeouts appropriately. Timeouts can be disabled by setting them to 0.
bootalert.options.timeOut = 30; // How long the bootalert will display without user interaction
bootalert.options.extendedTimeOut = 60; // How long the bootalert will display after a user hovers over it
Visually indicate how long before a bootalert expires.
bootalert.options.progressBar = true;
Flip the bootalert to be displayed properly for right-to-left languages.
bootalert.options.rtl = true;
To build the minified and css versions of bootalert you will need node installed. (Use Homebrew or Chocolatey.)
npm install -g gulp karma-cli
npm install
At this point the dependencies have been installed and you can build bootalert
- Run the analytics
gulp analyze
- Run the test
gulp test
- Run the build
gulp