-
Notifications
You must be signed in to change notification settings - Fork 12
/
index.html
89 lines (71 loc) · 2.27 KB
/
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<html>
<head>
<title>Simpel Javascript Library for detecting Left-Right Swap on any Touchscreen device</title>
<style>
body{
margin:0px;
text-align: center;
font-family: cursive;
}
header{
width:100vw;
background: d1d1d1;
}
main{
width:100vw;
background: white;
margin : 40px
}
footer{
width:100vw;
margin : 40px
background: brown;
}
.touchsurface{
width:200px;
height:200px;
background:yellow;
float: left;
margin: 15px;
}
</style>
</head>
<body>
<a href="https://github.com/Vikylp/swipe">
<img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png" alt="Fork me on GitHub"></a>
<header id="headertag">
<div class="container">
<div class="page-header">
<h1>Swipe <small>a pure Javascript plugin for touch devices</small></h1>
<br/>
<p>swipe is a Javascript plugin to be used on touch input devices such as surface, android, iPad, iPhone etc.</p>
<P>Actualy it works on any divice with tuch support and runs Javascript</p>
</div>
<h1>Features</h1>
<ul>
<li>Detects swipes in 2 directions, "left" and "right"</li>
<li>Allow to adjest sencitivity </li>
<li>Allow to use Event Attrebute "onSwipe"</li>
<li>Allow to add addEventListener "Swipe" on any element in Javascript</li>
</ul>
<h1>Demos</h1>
</header>
<main id="maintag">
<div id="touchsurface" class="touchsurface" onSwap="alert('Swaped ' + event.detail.direction + ' at ' + event.target.id);">
<h2>touchsurface</h2><p>Swipe event call by inline coding</p></div>
<div id="touchsurface1" class="touchsurface" onSwap="touchsurfaceSwap(event)"><h2>touchsurface1</h2>Swipe event called by event attribute </div>
<div id="touchsurface2" class="touchsurface" ><h2>touchsurface3</h2>Swipe event called by event in code </div>
</main>
<footer id="someElement">
</footer>
<script src="swipe.js"></script>
<script>
// onclick="alert(event.target.id);" swap.js
touchsurface = document.getElementById('touchsurface2');
touchsurface.addEventListener("swap", function(event){alert('Swaped ' + event.detail.direction + ' at ' + event.target.id);}, false);
function touchsurfaceSwap(event){
alert('Swiped ' + event.detail.direction + ' at ' + event.target.id);
}
</script>
</body>
</html>