mn-touch
Version:
Ultrafast AngularJS touch events directive (tap, hold and swipe)
45 lines (42 loc) • 1.56 kB
HTML
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height">
<meta name="apple-mobile-web-app-capable" content="yes">
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular.min.js"></script>
<script src="../dist/mn-touch.js"></script>
<script src="example.js"></script>
<title>mn-touch test</title>
</head>
<body>
<div ng-controller="example" style="text-align:center;">
<div id="container">
<button
mn-touch
tap="log($event)">
Tap me!
</button>
<div
id="button"
mn-touch
secure-tap="log($event)"
swipe-up="log($event)"
swipe-right="log($event)"
swipe-down="log($event)"
swipe-left="log($event)"
style="width:100px;height:100px;background:red;padding:30px;margin:20px auto;">
Tap (secure) or swipe me!
</div>
<button
mn-touch
secure-tap="log($event)"
hold="log($event)"
holdfor="1000">
Tap (secure) or hold me!
</button>
</div>
</div>
</body>
</html>