Showing
1 changed file
with
19 additions
and
6 deletions
@@ -18,7 +18,6 @@ var $ = require('jquery'), | @@ -18,7 +18,6 @@ var $ = require('jquery'), | ||
18 | scH, | 18 | scH, |
19 | $nav1 = $('#pos-nav'), | 19 | $nav1 = $('#pos-nav'), |
20 | $nav2 = $('#pos-list'), | 20 | $nav2 = $('#pos-list'), |
21 | - $homePage = $('.discount-area'), | ||
22 | sTop; | 21 | sTop; |
23 | 22 | ||
24 | var tip = require('../plugin/tip'), | 23 | var tip = require('../plugin/tip'), |
@@ -111,15 +110,31 @@ if ($('.multi-browse').find('li').size() > 1) { | @@ -111,15 +110,31 @@ if ($('.multi-browse').find('li').size() > 1) { | ||
111 | } | 110 | } |
112 | 111 | ||
113 | function getPageGoods(info) { | 112 | function getPageGoods(info) { |
113 | + var nav,navType; | ||
114 | + | ||
114 | if (searching) { | 115 | if (searching) { |
115 | return; | 116 | return; |
116 | } | 117 | } |
118 | + | ||
119 | + navType = info.data.type; | ||
120 | + nav = navInfo[navType]; | ||
121 | + | ||
122 | + //不需要重新加载并且数据请求结束 | ||
123 | + if (nav.end) { | ||
124 | + | ||
125 | + return; | ||
126 | + } | ||
127 | + | ||
117 | searching = true; | 128 | searching = true; |
118 | $.ajax({ | 129 | $.ajax({ |
119 | type: 'GET', | 130 | type: 'GET', |
120 | url: info.url, | 131 | url: info.url, |
121 | data: info.data, | 132 | data: info.data, |
122 | success: function(data) { | 133 | success: function(data) { |
134 | + if (data === ' ') { | ||
135 | + nav.end = true; | ||
136 | + } | ||
137 | + | ||
123 | info.callBack(data); | 138 | info.callBack(data); |
124 | }, | 139 | }, |
125 | error: function() { | 140 | error: function() { |
@@ -661,11 +676,9 @@ function scrollHandler() { | @@ -661,11 +676,9 @@ function scrollHandler() { | ||
661 | } | 676 | } |
662 | 677 | ||
663 | //srcoll to load more | 678 | //srcoll to load more |
664 | -if ($homePage.length > 0) { | ||
665 | - $(window).scroll(function() { | ||
666 | - window.requestAnimationFrame(scrollHandler); | ||
667 | - }); | ||
668 | -} | 679 | +$(window).scroll(function() { |
680 | + window.requestAnimationFrame(scrollHandler); | ||
681 | +}); | ||
669 | 682 | ||
670 | 683 | ||
671 | //初始请求最新第一页数据 | 684 | //初始请求最新第一页数据 |
-
Please register or login to post a comment