; angular.module(, []) .directive(, () { { controller: [, , ($scope, $element) { $element.bind(, onTouchStart); onTouchStart(event) { method = $element.attr(); $scope.$event = event; $scope.$apply(method); } }] } }) .directive(, () { { controller: [, , ($scope, $element) { $element.bind(, onTouchStart); onTouchStart(event) { event.preventDefault(); $element.bind(, onTouchMove); $element.bind(, onTouchEnd); } onTouchMove(event) { method = $element.attr(); $scope.$event = event; $scope.$apply(method); } onTouchEnd(event) { event.preventDefault(); $element.unbind(, onTouchMove); $element.unbind(, onTouchEnd); } }] } }) .directive(, () { { controller: [, , ($scope, $element) { $element.bind(, onTouchEnd); onTouchEnd(event) { method = $element.attr(); $scope.$event = event; $scope.$apply(method); } }] } });
usage
var app = angular.module("demoapp", ["ngTouch"]);
<div ng-touchmove="someFunction($event)"
ng-touchstart="someFunction($event)"
ng-touchend="someFunction($event)"></div>
https://github.com/nglar/ngTouchmove/tree/master/src
-
« 上一篇:
模拟的input:checkbox的问题
-
浏览器解析
:下一篇 »