bootstrap.simpleNotification.js

;(function ($, window, document, undefined) { "use strict"; $.extend({ vNotify: function (options, type) { var def = { 'type': 'info', 'duration': 0, 'dismissable': true, 'message': '', 'class': '', 'container': 'body' }; if ($.type(options) === "string") options = { message: options }; if (type) options.type = type; options = $.extend({}, def, options); // container options.container = $(options.container).length ? $(options.container) : $('.alert-box.fixed').length ? $('.alert-box.fixed') : $('<div class="alert-box fixed" />').appendTo('body'); // create alert var $al = $("<div />", { class: 'alert alert-' + options.type, text: options.message }); options.class && $al.addClass(options.class); options.dismissable && $al.addClass('alert-dismissible').prepend('<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>'); options.container.append(function () { if (options.duration) return $al.fadeIn().delay(options.duration).fadeOut(function () { $(this).remove(); }); return $al; }); } }); }(jQuery, window, document)); /* ====== CSS ====== .alert-box.fixed { position: fixed; padding: 0 20px; bottom: 0; right: 0; width: 600px; max-width: 100%; z-index: 900; } =================== */ /* $.vNotify('Message'); $.vNotify('Message', 'success'); // info/success/danger/warning $.vNotify({ 'message': 'Message', 'type': 'danger', // info/success/danger/warning 'duration': 2000, 'dismissable': true, // show/hide close-button 'class': 'bg-purple', // custom class 'container': '#selector' }); */
simple notification for bootstrap

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.