Blame view

WebRoot/static/js/loading.js 1.27 KB
6429ab88   孙向锦   remove
1
2
3
4
5
6
7
8
9
10
11
  /***********************
  *名称:加载等待插件
  *日期:2018717
  *用法:此插件依托于jquery插件,所以在使用时,需要在jquery后引入,且此插件需要置入body内。
  *      展示loadingloading.show(url),urlloading.gif图片路径。移除loadingloading.remove();
  *      可放入$(document).ready()内;
  ***********************/
  
  
  var loading={
  	show:function(url){
3371dbc6   孙向锦   0720 版本
12
13
14
  		if(typeof(url) == "undefined"){
  			url = '../static/images/loading.gif' ;
  		}
6429ab88   孙向锦   remove
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  		if(window.top!=window.self){
  			$("body",top.document).append('<div class="loading" style="background:rgba(0,0,0,0.5);width:100%;height:100%;position:fixed;top:0;display:block;"><img src="'+url+'" width="200px" style="position:absolute;top:0;bottom:0;left:0;right:0;margin:auto;"/></div>');
  		}else{
  			if($(".loading").length==0)
  			{
  				//alert($("body").length);
  				$("body").append('<div class="loading" style="background:rgba(0,0,0,0.5);width:100%;height:100%;position:fixed;top:0;display:block;"><img src="'+url+'" width="200px" style="position:absolute;top:0;bottom:0;left:0;right:0;margin:auto;"/></div>');
  			}
  		}
  	},
  	remove:function(){
  		if(window.top!=window.self){
  			$(".loading",top.document).remove();
  		}else{
  			if($(".loading").length>0)
  			$(".loading").remove();
  		}
  			
  	}
  }