You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

6 lines
916 B
JavaScript

/**
* 弹窗
* @author 鹿文学
*/
;(function(d){d.fn.pop=function(g){var a=this;a.options=d.extend(!0,{text:"",speed:800,main:"pop-wrap"},g);a.open=function(b,c){b=b||a.options.speed;c&&e(c);a.fadeIn(b);return a};a.close=function(b){b=b||a.options.speed;b=f(b);a.fadeOut(b);setTimeout(function(){a.find("."+a.options.main).html("")},b+100);return a};a.clear=function(){a.find("."+a.options.main).html("");return a};var e=a.add=function(b){0<a.find("."+a.options.main).length?a.find("."+a.options.main).html("").append(b):a.append("<span>"+
b+"</span>");return a};a.msg=function(b,c){var d=f(a.options.speed);c=c||2E3;a.html("").append("<span>"+b+"</span>").stop(!0).fadeIn(d);setTimeout(function(){a.fadeOut(d)},c);return a};var f=function(a){if("string"==typeof a)switch(a){case "slow":a=600;break;case "normal":a=400;break;case "fast":a=200}return parseInt(a)};e(a.options.text);return this}})(window.jQuery);