Authored by xuqi

guang loading

@@ -73,18 +73,20 @@ navHammer.on('tap', function(e) { @@ -73,18 +73,20 @@ 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) {
  83 +
  84 + //无数据时隐藏正在加载和没有更多字样
  85 + $loading.addClass('hide');
  86 + $noMore.addClass('hide');
  87 +
86 loadMore($content, state[curType]); 88 loadMore($content, state[curType]);
87 - } 89 + } else {
88 90
89 //重置当前Tab的load-more 91 //重置当前Tab的load-more
90 if (state[curType].end) { 92 if (state[curType].end) {
@@ -94,6 +96,14 @@ navHammer.on('tap', function(e) { @@ -94,6 +96,14 @@ navHammer.on('tap', function(e) {
94 $loading.removeClass('hide'); 96 $loading.removeClass('hide');
95 $noMore.addClass('hide'); 97 $noMore.addClass('hide');
96 } 98 }
  99 + }
  100 +
  101 + $infos.not('.hide').addClass('hide');
  102 + $content.removeClass('hide');
  103 +
  104 + if (state[curType].page === 1) {
  105 + window.rePosFooter();//进入空内容时重新定位footer位置
  106 + }
97 }); 107 });
98 108
99 $(document).scroll(function() { 109 $(document).scroll(function() {
@@ -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}}