touchMoveSliderCateList = function(x, y){
var $list = jqueryMap.$cateListUl,
// 获取用户手指滑动距离
offset = {
x : x - stateMap.touchStartPos.x,
y : y - stateMap.touchStartPos.y
};
$list.css('transform', 'translate3d(0px, ' + (offset.y - Math.abs(stateMap.listOffsetTop)) + 'px, 0px)');
};
目前我是用tuchmove的最后位置减去touchstart的起始位置,得到用户手指滑动的距离,在用户移动的途中不停的设置到元素上,移动元素是没问题,但是感觉太生硬,我希望在我手指松开后,能偶惯性移动一点距离,如何做呢??
自己手写惯性可能有点累,不介意的话,可以直接用别人写好的iscroll
不过如果非想自己搞,好像ios
上还挺容易:ios-scrolling
添加-webkit-overflow-scrolling: touch;但是仅ios支持