Authored by xuqi

guang loading

@@ -73,26 +73,36 @@ navHammer.on('tap', function(e) { @@ -73,26 +73,36 @@ navHammer.on('tap', function(e) {
73 $this.addClass('focus'); 73 $this.addClass('focus');
74 $curNav.removeClass('focus'); 74 $curNav.removeClass('focus');
75 75
76 - $infos.not('.hide').addClass('hide');  
77 -  
78 $content = $infos.eq(index); 76 $content = $infos.eq(index);
79 - $content.removeClass('hide');  
80 77
81 $curNav = $this; 78 $curNav = $this;
82 curType = $this.data('type'); 79 curType = $this.data('type');
83 80
84 //当未加载数据时去请求数据 81 //当未加载数据时去请求数据
85 if (state[curType].page === 1) { 82 if (state[curType].page === 1) {
86 - loadMore($content, state[curType]);  
87 - }  
88 83
89 - //重置当前Tab的load-more  
90 - if (state[curType].end) { 84 + //无数据时隐藏正在加载和没有更多字样
91 $loading.addClass('hide'); 85 $loading.addClass('hide');
92 - $noMore.removeClass('hide');  
93 - } else {  
94 - $loading.removeClass('hide');  
95 $noMore.addClass('hide'); 86 $noMore.addClass('hide');
  87 +
  88 + loadMore($content, state[curType]);
  89 + } else {
  90 +
  91 + //重置当前Tab的load-more
  92 + if (state[curType].end) {
  93 + $loading.addClass('hide');
  94 + $noMore.removeClass('hide');
  95 + } else {
  96 + $loading.removeClass('hide');
  97 + $noMore.addClass('hide');
  98 + }
  99 + }
  100 +
  101 + $infos.not('.hide').addClass('hide');
  102 + $content.removeClass('hide');
  103 +
  104 + if (state[curType].page === 1) {
  105 + window.rePosFooter();//进入空内容时重新定位footer位置
96 } 106 }
97 }); 107 });
98 108
@@ -128,6 +128,7 @@ function loadMore($container, opt) { @@ -128,6 +128,7 @@ function loadMore($container, opt) {
128 128
129 return; 129 return;
130 } 130 }
  131 +
131 $container.append(data); 132 $container.append(data);
132 133
133 if (num > 0) { 134 if (num > 0) {
@@ -140,6 +141,10 @@ function loadMore($container, opt) { @@ -140,6 +141,10 @@ function loadMore($container, opt) {
140 141
141 if (opt.page === 1) { 142 if (opt.page === 1) {
142 loading.hideLoadingMask(); 143 loading.hideLoadingMask();
  144 +
  145 + $loading.removeClass('hide');//显示空屏加载时hide的隐藏
  146 +
  147 + window.rePosFooter();//插入内容后重新计算底部位置
143 } 148 }
144 149
145 opt.page++; 150 opt.page++;
1 .loading-mask { 1 .loading-mask {
2 - position: absolute; 2 + position: fixed;
3 background: rgba(0,0,0,.1); 3 background: rgba(0,0,0,.1);
4 top: 0; 4 top: 0;
5 bottom: 0; 5 bottom: 0;
@@ -37,7 +37,7 @@ @@ -37,7 +37,7 @@
37 37
38 <div id="info-list" class="info-list-container"> 38 <div id="info-list" class="info-list-container">
39 {{# infos}} 39 {{# infos}}
40 - <div class="info-list {{^show}}hide{{/show}}"> 40 + <div class="info-list{{^show}} hide{{/show}}">
41 {{# info}} 41 {{# info}}
42 {{> guang/info}} 42 {{> guang/info}}
43 {{/ info}} 43 {{/ info}}