-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
93 lines (91 loc) · 2.83 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
90
91
92
93
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Drag/Swipe To Scroll Example</title>
<style type="text/css">
*{ margin: 0; padding: 0 }
body { background: #fafafa; }
.container { margin: 150px auto; max-width: 960px; text-align: center; }
.drag-box{
width: 400px;
height: 300px;
margin: 20px auto;
overflow: hidden;
border: 3px dotted #222;
background: #f8f8f8;
line-height: 25px;
font-size: 14px;
}
.drag{
width: 150%;
padding: 10px;
cursor: grab;
-moz-user-select:none;
-webkit-user-select:none;
-ms-user-select:none;
-khtml-user-select:none;
user-select:none;
}
.drag-x{
width: 150%;
padding: 10px;
cursor: grab;
-moz-user-select:none;
-webkit-user-select:none;
-ms-user-select:none;
-khtml-user-select:none;
user-select:none;
}
.drag-y{
padding: 10px;
cursor: grab;
-moz-user-select:none;
-webkit-user-select:none;
-ms-user-select:none;
-khtml-user-select:none;
user-select:none;
}
</style>
</head>
<body>
<div class="container">
<h1>Drag/Swipe To Scroll Example</h1>
<div class="drag-box">
<div class="drag"><img src="https://source.unsplash.com/ogLJ4BusYzE/1600x900"></div>
</div>
<h2>direction: 'scrollLeft'</h2>
<div class="drag-box">
<div class="drag-x"><img src="https://source.unsplash.com/ExVr8jODhyo/1600x900"></div>
</div>
<h2>direction: 'scrollTop'</h2>
<div class="drag-box">
<div class="drag-y"><img src="https://source.unsplash.com/wEy8TRGUuLY/1600x900"></div>
</div>
</div>
<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" crossorigin="anonymous"></script>
<script src="./jquery.dragScroll.js"></script>
<script type="text/javascript">
$('.drag').dragScroll({
onStart: function($this) {
console.log($this);
},
onMove: function($this) {
console.log($this);
},
onEnd: function($this) {
console.log($this);
}
});
// $('.drag').dragscroll('destroy');
$('.drag-x').dragScroll({
direction: 'scrollLeft'
});
$('.drag-y').dragScroll({
direction: 'scrollTop'
});
</script>
</body>
</html>