列表仿微信式滑动及点击

var topValue = 0;// 上次滚动条到顶部的距离
var timeValue;
$("滚动条所在div").on('scroll', function () {
topValue = document.documentElement.scrollTop;
timeValue = new Date().getTime();
});
var falg = false;
$('列表需要点击跳转的div').on('touchstart touchmove touchend', function (event) {
switch (event.type) {
case 'touchstart':
falg = false;
break;
case 'touchmove':
falg = true;
break;
case 'touchend':
if (!falg && document.documentElement.scrollTop == topValue && new Date().getTime() > timeValue + 200) {
//点击
// 跳转
} else {//滑动


}
break;
}
});

原文地址:https://www.cnblogs.com/ptisagoodman/p/7724475.html