diff --git a/js/bootstrap-notify.js b/js/bootstrap-notify.js index e58c6c5..bdeb1bd 100644 --- a/js/bootstrap-notify.js +++ b/js/bootstrap-notify.js @@ -24,7 +24,11 @@ this.options = $.extend(true, {}, $.fn.notify.defaults, options); // Setup from options - if(this.options.transition) { + if(this.options.note) { + this.$note = this.options.note; + } + + if(this.options.transition) { if(this.options.transition == 'fade') this.$note.addClass('in').addClass(this.options.transition); else @@ -32,26 +36,28 @@ } else this.$note.addClass('fade').addClass('in'); - if(this.options.type) - this.$note.addClass('alert-' + this.options.type); - else - this.$note.addClass('alert-success'); + if(!this.options.note) { + if(this.options.type) + this.$note.addClass('alert-' + this.options.type); + else + this.$note.addClass('alert-success'); - if(!this.options.message && this.$element.data("message") !== '') // dom text - this.$note.html(this.$element.data("message")); - else - if(typeof this.options.message === 'object') { - if(this.options.message.html) - this.$note.html(this.options.message.html); - else if(this.options.message.text) - this.$note.text(this.options.message.text); - } else - this.$note.html(this.options.message); + if(!this.options.message && this.$element.data("message") !== '') // dom text + this.$note.html(this.$element.data("message")); + else + if(typeof this.options.message === 'object') { + if(this.options.message.html) + this.$note.html(this.options.message.html); + else if(this.options.message.text) + this.$note.text(this.options.message.text); + } else + this.$note.html(this.options.message); - if(this.options.closable) { - var link = $('×'); - $(link).on('click', $.proxy(onClose, this)); - this.$note.prepend(link); + if(this.options.closable) { + var link = $('×'); + $(link).on('click', $.proxy(onClose, this)); + this.$note.prepend(link); + } } return this;