(function($) { $.sNotify = function(options) { console.log('1'); if (!this.length) { return this; } var $wrapper = $('
').css({ position: 'fixed', display: 'none', right: '1.7em', top: '3.3em', padding: '1em', 'background-color': 'white', 'box-shadow': '0px 0px 6px 0px rgba(0,0,0,0.1)', 'z-index': 99999 }); $wrapper.wrapInner(this); $wrapper.appendTo('body'); if (options.icon) { $('').addClass(options.icon).appendTo($wrapper); } if (options.content) { $('
').css('display', 'inline-block').wrapInner(options.content).appendTo($wrapper); } setTimeout(function() { $wrapper.fadeIn(); if (options.delay) { setTimeout(function() { $wrapper.fadeOut(function() { $wrapper.remove(); }); }, options.delay); } }, 200); return $.extend($wrapper, { close: function(timeout) { setTimeout(function() { $wrapper.fadeOut(function() { $wrapper.remove(); }); }, timeout || '0'); }, update: function(content, icon) { this.find('.notify-content').empty().append(content); if (icon) { this.find('i').removeClass().addClass(icon); } return this; } }); }; })(jQuery);