整理之Gea检索滑动请求分页(jQuery)
作者:互联网
if (window.innerWidth <= 960) { loadList({ channelid: channelid, pageNo: pageNo, pageSize: mobSize, searchword: searchword }, true) /*判断上下滑动:*/ $(window).on('touchstart', function (e) { startX = e.originalEvent.changedTouches[0].pageX; startY = e.originalEvent.changedTouches[0].pageY; }); $(window).on("touchmove", function (e) { //获取滑动屏幕时的X,Y endX = e.originalEvent.changedTouches[0].pageX; endY = e.originalEvent.changedTouches[0].pageY; //获取滑动距离 distanceX = endX - startX; distanceY = endY - startY; //判断滑动方向 if (Math.abs(distanceX) > Math.abs(distanceY) && distanceX > 0) { } else if (Math.abs(distanceX) > Math.abs(distanceY) && distanceX < 0) { } else if (Math.abs(distanceX) < Math.abs(distanceY) && distanceY < 0) { setTimeout(function () { scrollFlag = true; }, 1000); if (scrollFlag) { if ($(window).scrollTop() >= 2000) { loadList({ channelid: channelid, pageNo: ++pageNo, pageSize: mobSize, searchword: searchword }, true) } scrollFlag = false; } } else if (Math.abs(distanceX) < Math.abs(distanceY) && distanceY > 0) { } }) } else { loadList({ channelid: channelid, pageNo: 1, pageSize: pcSize, searchword: searchword }) }
标签:jQuery,请求分页,distanceX,distanceY,else,Gea,abs,searchword,Math 来源: https://www.cnblogs.com/qiu2841/p/11096948.html