|
|
//不要使用es6
|
|
|
"use strict";
|
|
|
// 不要使用es6
|
|
|
'use strict';
|
|
|
|
|
|
var $ = require('yoho-jquery'),
|
|
|
Hammer = require('yoho-hammer'),
|
...
|
...
|
@@ -9,9 +9,11 @@ var $ = require('yoho-jquery'), |
|
|
var employ,
|
|
|
statu = 0,
|
|
|
page = 1,
|
|
|
//防止重复请求
|
|
|
|
|
|
// 防止重复请求
|
|
|
AjaxFlag = 0,
|
|
|
//上滑不请求
|
|
|
|
|
|
// 上滑不请求
|
|
|
direction = true;
|
|
|
|
|
|
var couponAJAX = function(statu, page) {
|
...
|
...
|
@@ -35,7 +37,7 @@ var couponAJAX = function(statu, page) { |
|
|
AjaxFlag = 0;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
var scrollHandler = function() {
|
|
|
if (direction && ($(window).scrollTop() + $(window).height() > $('body').height() - 100)) {
|
...
|
...
|
@@ -43,14 +45,14 @@ var scrollHandler = function() { |
|
|
couponAJAX(statu, page);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
|
|
|
|
|
|
require('../common');
|
|
|
|
|
|
ellipsis.init();
|
|
|
|
|
|
//判断滑动方向
|
|
|
// 判断滑动方向
|
|
|
$('body').on('touchstart', function(e) {
|
|
|
var touch = e.originalEvent,
|
|
|
startX = touch.changedTouches[0].pageX,
|
...
|
...
|
@@ -62,12 +64,12 @@ $('body').on('touchstart', function(e) { |
|
|
$('body').off('touchmove');
|
|
|
} else if (touch.pageX - startX < -10) {
|
|
|
$('body').off('touchmove');
|
|
|
};
|
|
|
}
|
|
|
if (touch.pageY - startY > 10) {
|
|
|
direction = false;
|
|
|
} else if (touch.pageY - startY < -10) {
|
|
|
direction = true;
|
|
|
};
|
|
|
}
|
|
|
});
|
|
|
}).on('touchend', function() {
|
|
|
$('body').off('touchmove');
|
...
|
...
|
@@ -92,4 +94,4 @@ $(window).scroll(function() { |
|
|
window.requestAnimationFrame(scrollHandler);
|
|
|
});
|
|
|
|
|
|
couponAJAX(statu, page); |
|
|
\ No newline at end of file |
|
|
couponAJAX(statu, page); |
...
|
...
|
|