news
news copied to clipboard
触摸滑动
在对应控制器注入服务swipe
app.controller('autumnsCtrl', ['$scope', 'swipe', function($scope, swipe) {}])
在swipe对象上面执行method服务,并传入需要执行的回调函数
格式swipe.method([方向],[回调函数])
方向为四个top,bottom,left,right
回调函数的参数可以获取滑动前后的x和y坐标,并且方向的信息
具体是对象中的x1,x2,y1,y2属性,和direction属性
例如
swipe.method("bottom",function(e){
console.log(e)
})