loading.js 981 B

1
  1. UI.extend.loading=function(type,msg,opt){$("#pup_autoclose").remove();if(msg=="/"){return}var bgStr="";switch(type){case 1:bgStr="loadSuccess";break;case 2:bgStr="loadError";break;case 3:bgStr="loading";break;case 4:bgStr="loadInfo";break}var str='<div class="lvtip '+bgStr+'" id="pup_autoclose" style="position:fixed;display:none;padding:20px 40px;"><label>'+msg+"</label></div>";var obj=$(str).show();obj.appendTo("body");if(opt.positionTo){var pot=$(opt.positionTo);var potOft=pot.offset();obj.css({left:potOft.left+pot.outerWidth(true)+10,top:potOft.top,zIndex:opt.zIndex,display:"none"})}else{obj.css({left:"50%",zIndex:opt.zIndex,top:$(window).height()/2,marginLeft:-obj.outerWidth()/2,marginTop:-obj.outerHeight()/2,display:"none"})}obj.show();var func=typeof opt=="function"?opt:undefined;var time=typeof opt=="number"?opt:0;if(type==1||type==2){setTimeout(function(){obj.fadeOut(200,func)},time||800)}if(type==4){setTimeout(function(){obj.fadeOut(200,func)},time||1500)}};