拖动试试
移动端可以根据这种方式判断滑动手势
function DragBase() { var prevX, prevY, toX, toY; this.start = function (x, y) { prevX = x; prevY = y; toX = 0; toY = 0; }; this.move = function (x, y, fn) { toX = x - prevX; toY = y - prevY; fn(toX, toY); prevX = x; prevY = y; }; }
时间: 2024-11-08 02:07:04