diff --git a/bootstrap-notify.js b/bootstrap-notify.js index d97e4c0..135dca8 100644 --- a/bootstrap-notify.js +++ b/bootstrap-notify.js @@ -33,6 +33,7 @@ from: "top", align: "right" }, + restrict: 0, offset: 20, spacing: 10, z_index: 1031, @@ -121,6 +122,12 @@ //if duplicate messages are not allowed, then only continue if this new message is not a duplicate of one that it already showing if (this.settings.allow_duplicates || (!this.settings.allow_duplicates && !isDuplicateNotification(this))) { this.init(); + + // if restrict + var _length = $('[data-notify="container"]').length; + if (this.settings.restrict > 0 && _length >= this.settings.restrict) { + $('[data-notify="container"]').find('button[data-notify="dismiss"]').slice(0,_length-this.settings.restrict).trigger('click'); + } } } @@ -413,5 +420,3 @@ })); - -