-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
29 lines (29 loc) · 1010 Bytes
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>远程控制PPT</title>
<script src="js/socket.io.js"></script>
<script src="js/hammer.min.js"></script>
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1">
</head>
<body id="body" style="width: 500px;height: 500px;background-color: beige">
<p>滑动控制切换</p>
</body>
<script>
var socket = io.connect('http://127.0.0.1:3000');
// socket.on('broadcast', function (data) {
// console.log(data);
// });
var hammertime = new Hammer(document.getElementById('body'));
function sendAction(ev) {
console.log(ev.type);
socket.emit('action', ev.type);
}
hammertime.get('swipe').set({direction: Hammer.DIRECTION_ALL});
hammertime.on('swipeleft', sendAction);
hammertime.on('swiperight', sendAction);
hammertime.on('swipeup', sendAction);
hammertime.on('swipedown', sendAction);
</script>
</html>