-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjquery.notification.min.js
1 lines (1 loc) · 1.26 KB
/
jquery.notification.min.js
1
"use strict";!function(t){t.notification={settings:{time:400,delay:1e4},element:".notification_block",elementClose:".notification_block .close_notice",count:0,elementBuffer:[],show:function(e,n){var i=this,s=this.append(e,n),o=this.elementBuffer[s];return this.restructuring(s),o.fadeIn(this.settings.time),setTimeout(function(){i.hide(s)},this.settings.delay),t(document).on("click",this.elementClose,function(){var e=t(this).parents(i.element).data("id");return i.hide(e),!1}),s},hide:function(t){var e=this,n=this.elementBuffer[t];return"undefined"!=typeof n?(n.fadeOut(this.settings.time),setTimeout(function(){n.remove(),delete e.elementBuffer[t],e.restructuring(t)},e.settings.time),!0):!1},append:function(e,n){var i='<div id="note_'+this.count+'" data-id="'+this.count+'" class="notification_block '+e+'"><a class="close_notice" href="#"></a><div class="content_notice">'+n+"</div></div>";return t("body").append(i),this.elementBuffer[this.count]=t(document).find("#note_"+this.count),this.count++,this.count-1},restructuring:function(){var t=this.elementBuffer,e=20;for(var n in t)if(t.hasOwnProperty(n)){t[n].css({top:e+"px"});var i=t[n].css("top"),s=t[n].outerHeight();e=parseInt(i)+parseInt(s)+10}},init:function(e){return this.settings=t.extend(this.settings,e),this}}}(jQuery);