Authored by whb

手机端链接

@@ -299,18 +299,23 @@ define('mobile', function(require, exports) { @@ -299,18 +299,23 @@ define('mobile', function(require, exports) {
299 var totalPage = Math.ceil(total / (limit * (total_times + 1))); 299 var totalPage = Math.ceil(total / (limit * (total_times + 1)));
300 if ($(window).scrollTop() >= $(document).height() - $(window).height() - 50) { 300 if ($(window).scrollTop() >= $(document).height() - $(window).height() - 50) {
301 if (total > limit && times < total_times && page <= totalPage) { 301 if (total > limit && times < total_times && page <= totalPage) {
  302 + if($(".main-layout").attr("is_ajax") == 1 || $("#img_page").size())
  303 + {
  304 + return true;
  305 + }
  306 + $(".main-layout").attr("is_ajax", 1);
302 $.ajax({ 307 $.ajax({
303 beforeSend:function() { 308 beforeSend:function() {
304 - if($(".loading").size() == 0)  
305 - {  
306 - $(".main-layout").append('<div class="loading"><img src="'+ YohoConfig.resUrl + '/images/yohood/loading.gif'+'" /></div>'); 309 + if($(".loading").size() == 0) {
  310 + $(".main-layout").append('<div class="loading" style="left: 47.5%;position:absolute;"><img src="'+ YohoConfig.resUrl + 'images/yohood/loading.gif'+'" /></div>');
307 } 311 }
  312 + return true;
308 }, 313 },
309 type: "get", 314 type: "get",
310 url: url + "/page/" + (parseInt(ajaxPage) + 1), 315 url: url + "/page/" + (parseInt(ajaxPage) + 1),
311 success: function(data) { 316 success: function(data) {
312 - $(".loading").remove();  
313 var news_page = $(data); 317 var news_page = $(data);
  318 + page = Math.ceil(parseInt(news_page.attr("page")) / (total_times + 1)); //实现页码
314 if ($(".main-layout").attr("page") != news_page.attr("page") && news_page.html() != "") { 319 if ($(".main-layout").attr("page") != news_page.attr("page") && news_page.html() != "") {
315 $(".main-layout").append(news_page.html()); 320 $(".main-layout").append(news_page.html());
316 $(".main-layout").attr({ 321 $(".main-layout").attr({
@@ -318,15 +323,18 @@ define('mobile', function(require, exports) { @@ -318,15 +323,18 @@ define('mobile', function(require, exports) {
318 "page": news_page.attr("page"), 323 "page": news_page.attr("page"),
319 "times": ++times 324 "times": ++times
320 }); 325 });
321 - // console.log(news_page.attr("page"));  
322 - // console.log("times:" + times);  
323 - }  
324 - page = Math.ceil(parseInt(news_page.attr("page")) / (total_times + 1)); //实现页码  
325 - // console.log("page:" + page);  
326 - // console.log("totalPage:" + totalPage); 326 + //console.log(news_page.attr("page"));
  327 + //console.log("times:" + times);
  328 + //console.log("page:" + page);
  329 + //console.log("totalPage:" + totalPage);
  330 + }
  331 + if($(".loading").size()){
  332 + $(".loading").remove();
  333 + }
327 if (times == total_times || news_page.html() == "" || page == totalPage) { 334 if (times == total_times || news_page.html() == "" || page == totalPage) {
328 $(".main-layout").append(getPagination(page, totalPage)); 335 $(".main-layout").append(getPagination(page, totalPage));
329 } 336 }
  337 + $(".main-layout").attr("is_ajax", 0);
330 } 338 }
331 }); 339 });
332 } else if (page == totalPage) { 340 } else if (page == totalPage) {