/* *usage //显示 $.AlerStatus({ status:'loading', //状态 msg:'上传中...', //文字0 duration:2000 //默认多少秒后隐藏,设null则一直不隐藏 }) //隐藏 $.AlerStatus({ type:'hide', //显示或隐藏,默认为show time:3000 //3s后隐藏,默认为0 }) //loading $.AlerBottom({ status:'loading', //加载中 duration:null, callback:function(){ } }) setTimeout(function(){ //加载完成 $.AlerBottom({ status:'loadingEnd', time:1000, duration:null, callback:function(){ $.AlerBottom({ status:'success', msg:'保存成功,正在为您跳转(5)', duration:null }) var leftTime=5; setInterval(function(){ if(leftTime==0){ //window.location.href="http://www.baidu.com"; }else{ leftTime-- $('#AlerBottom .info').text('保存成功,正在为您跳转('+leftTime+')'); } },1000) } }) },2000) */ (function (window, document) { //选择器初始化 var $AlerBottom,$AlerBottomIn,$AlerBottomBg,$info,$status; $(function () { init(); //初始化 //选择器初始化 $AlerBottom=$('#AlerBottom'); $AlerBottomBg=$AlerBottom.find('.AlerBottomBg'); $AlerBottomIn=$AlerBottomBg.find('.AlerBottomBg-in'); $info=$AlerBottom.find('.info'); $status=$AlerBottom.find('.status'); }) function init() { var _html = '' + '
'+ ''; var AlerHTML = document.createElement('div'); AlerHTML.innerHTML = _html; document.body.appendChild(AlerHTML); } //loading动画 var _loadingN=0; var A; var opts; $.AlerBottom = function (options,callback) { //默认参数 var defaults = { type: 'show', status: null, msg: null, time: 0, duration: 2000 }; opts = $.extend({}, defaults, options);//赋值到全局变量opts if (opts.type === 'show') { $AlerBottom.show(); if(opts.msg){ $info.text(opts.msg);//如果有内容,则填充内容 $AlerBottom.css('padding','10px 0'); }else if(opts.status!=="loadingEnd"){ $info.empty(); $status.empty(); $AlerBottom.css('padding','3px 0'); } if(opts.duration){ setTimeout(function(){ _hide(); },opts.duration); } switch(opts.status){ case 'loading': if(opts.msg){ $status.html('