|
|
"use strict";
|
|
|
|
|
|
var $ = require('yoho-jquery'),
|
|
|
Hammer = require('yoho-hammer'),
|
|
|
ellipsis = require('yoho-mlellipsis'),
|
...
|
...
|
@@ -5,12 +7,44 @@ var $ = require('yoho-jquery'), |
|
|
|
|
|
var employ,
|
|
|
statu = 0,
|
|
|
page = 1;
|
|
|
page = 1,
|
|
|
//防止重复请求
|
|
|
AjaxFlag = 0,
|
|
|
//上滑不请求
|
|
|
direction = true;
|
|
|
|
|
|
require('../common');
|
|
|
|
|
|
ellipsis.init();
|
|
|
|
|
|
//判断滑动方向
|
|
|
$('body').on('touchstart', function(e) {
|
|
|
var touch = e.originalEvent,
|
|
|
startX = touch.changedTouches[0].pageX,
|
|
|
startY = touch.changedTouches[0].pageY;
|
|
|
$('body').on('touchmove', function(e) {
|
|
|
touch = e.originalEvent.touches[0] ||
|
|
|
e.originalEvent.changedTouches[0];
|
|
|
if (touch.pageX - startX > 10) {
|
|
|
$('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');
|
|
|
});
|
|
|
|
|
|
function couponAJAX(statu, page) {
|
|
|
return;
|
|
|
if (AjaxFlag) {
|
|
|
return;
|
|
|
}
|
|
|
AjaxFlag = 1;
|
|
|
loading.showLoadingMask();
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
...
|
...
|
@@ -24,6 +58,7 @@ function couponAJAX(statu, page) { |
|
|
$('#employ').append(data);
|
|
|
window.rePosFooter();
|
|
|
loading.hideLoadingMask();
|
|
|
AjaxFlag = 0;
|
|
|
}
|
|
|
});
|
|
|
}
|
...
|
...
|
@@ -43,7 +78,7 @@ $('.employ span').each(function(index) { |
|
|
|
|
|
|
|
|
function scrollHandler() {
|
|
|
if ($(window).scrollTop() + $(window).height() > $('body').height() - 100) {
|
|
|
if (direction && ($(window).scrollTop() + $(window).height() > $('body').height() - 100)) {
|
|
|
page++;
|
|
|
couponAJAX(statu, page);
|
|
|
return;
|
...
|
...
|
@@ -54,4 +89,4 @@ $(window).scroll(function() { |
|
|
window.requestAnimationFrame(scrollHandler);
|
|
|
});
|
|
|
|
|
|
couponAJAX(statu, page); |
|
|
couponAJAX(statu, page); |
|
|
\ No newline at end of file |
...
|
...
|
|