-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
45 lines (44 loc) · 916 Bytes
/
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Demo</title>
<style>
.content {
width: 300px;
height: 200px;
margin: auto;
margin-top: 100px;
background: #eee;
border: 1px solid #ddd;
text-align: center;
position: relative;
font-size: 24px;
}
.content .tip {
font-weight: bold;
margin-top: 50px;
text-align: center;
}
</style>
</head>
<body>
<div class="content">
Wheel Your Mouse Here
<div class="tip"></div>
</div>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="js/MouseWheelUtil.js"></script>
<script type="text/javascript">
var count = 0;
new MouseWheelUtil($('.content'), {
sensitivity: 5,
timeLimit: 450,
onWheel: function (direction) {
count++;
$('.tip').text('Scroll ' + (direction === 1 ? 'up' : 'down') + ', count: ' + count);
}
});
</script>
</body>
</html>