Showing
1 changed file
with
9 additions
and
3 deletions
@@ -47,13 +47,19 @@ var loadOrderList = function(pageIndex, type) { | @@ -47,13 +47,19 @@ var loadOrderList = function(pageIndex, type) { | ||
47 | } | 47 | } |
48 | }; | 48 | }; |
49 | 49 | ||
50 | - | 50 | +var lastScrollTop = 0; |
51 | +var windowHeight = $(window).height(); | ||
51 | var scrollFn = debounce(function() { | 52 | var scrollFn = debounce(function() { |
52 | - if ($(window).scrollTop() >= $(document).height() - $(window).height() - 10) { | ||
53 | - // alert('end of page'); | 53 | + var scrollTop = $(window).scrollTop(); |
54 | 54 | ||
55 | + // 当scroll到1/4列表高度后继续请求下一页数据 | ||
56 | + if (scrollTop > lastScrollTop && | ||
57 | + (scrollTop + windowHeight > | ||
58 | + $(document).height() - 0.25 * $('#order-list').height() - 50)) { | ||
55 | loadOrderList(search.type, ++search.pageIndex); | 59 | loadOrderList(search.type, ++search.pageIndex); |
56 | } | 60 | } |
61 | + | ||
62 | + lastScrollTop = scrollTop; | ||
57 | }, 500); | 63 | }, 500); |
58 | 64 | ||
59 | /** | 65 | /** |
-
Please register or login to post a comment