-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathdemo.html
145 lines (122 loc) · 3.31 KB
/
demo.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<!DOCTYPE HTML>
<html>
<head>
<title>jQuery.kinetic demos</title>
<script
src="https://code.jquery.com/jquery-2.2.4.js"
integrity="sha256-iT6Q9iMJYuQiMWNd9lDyBUStIq/8PuOW33aOqmvFpqI="
crossorigin="anonymous"></script>
<script src="jquery.kinetic.js" type="text/javascript" charset="utf-8"></script>
<style type="text/css">
body {
font-family: arial, sans-serif;
}
pre code {
background: #ddd;
display: block;
padding: 10px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-o-border-radius: 5px;
border-radius: 5px;
}
#container {
margin: 0 auto;
}
#wrapper {
border: solid 5px #000;
height: 400px;
width: 100%;
overflow: hidden;
}
#controls {
padding: 10px;
}
#controls span {
cursor: pointer;
}
.kinetic-moving-up {
border-top-color: green !important;
}
.kinetic-moving-down {
border-bottom-color: green !important;
}
.kinetic-moving-left {
border-left-color: green !important;
}
.kinetic-moving-right {
border-right-color: green !important;
}
.kinetic-decelerating-up {
border-top-color: red !important;
}
.kinetic-decelerating-down {
border-bottom-color: red !important;
}
.kinetic-decelerating-left {
border-left-color: red !important;
}
.kinetic-decelerating-right {
border-right-color: red !important;
}
#inner {
width: 2000px;
height: 100px;
}
#inner img {
display: block;
width: 2000px;
}
#left, #right {
cursor: pointer;
}
</style>
</head>
<body>
<div id="container">
<p>
Drag a mouse or use touch gestures over the windows below to scroll
the pane. If you let go with momentum the scrolling will slow
gradually.
</p>
<div id="wrapper">
<div id="inner">
<img src="lib/wembley.jpg" alt="wembley stadium"/>
</div>
</div>
<div id="controls">
<span id="left">< left</span> |
<span id="right">right ></span>
--
<span id="end">end (decelerates)</span>
--
<span id="stop">stop (stop immediately)</span>
--
<span id="detach">detach</span>
--
<span id="attach">attach</span>
</div>
<script type="text/javascript" charset="utf-8">
$('#wrapper').kinetic();
$('#left').click(function() {
$('#wrapper').kinetic('start', { velocity: -10 });
});
$('#right').click(function() {
$('#wrapper').kinetic('start', { velocity: 10 });
});
$('#end').click(function() {
$('#wrapper').kinetic('end');
});
$('#stop').click(function() {
$('#wrapper').kinetic('stop');
});
$('#detach').click(function() {
$('#wrapper').kinetic('detach');
});
$('#attach').click(function() {
$('#wrapper').kinetic('attach');
});
</script>
</div>
</body>
</html>