-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
executable file
·102 lines (97 loc) · 2.15 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Demo</title>
<meta http-equiv="Expires" content="0">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Pragma" content="no-cache">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximun-scale=1.0,user-scalable=0">
<meta name="format-detection" content="telephone=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<style>
*{
padding: 0;
margin:0;
}
.canvas{
height: 4.9375rem;
width: 100%;
}
.pr{
position: relative;
}
.p{
position: absolute;
font-size: 24px;
color:#000;
text-align: center;
top:.2rem;
left: 0;
line-height: 2.4rem;
height: 2.4rem;
width: 100%;
}
</style>
</head>
<body>
<div class="pr">
<div class="canvas" id="canvas1"></div>
<p class="p" id="p1"></p>
</div>
<div class="pr">
<div class="canvas" id="canvas2"></div>
<p class="p" id="p2"></p>
</div>
<script src="scripts/vendor/zepto.js"></script>
<script src="scripts/components/requestAnimationFrame.js"></script>
<script src="scripts/components/tween.js"></script>
<script src="scripts/components/canvasScroll.js"></script>
<script>
(function($){
var scroll = [];
$('#p1').text('500');
// 数字数轴
var option = {
// 数轴数据 数组为枚举 对象为最大最小
data:{
defaultVal:500,
min:0,
max:100000,
},
// 元素
el:$('#canvas1'),
scrollMove:function(){
$('#p1').text(scroll[0].valText);
},
scrollEnd:function(){
$('#p1').text(scroll[0].valText);
}
}
scroll[0] = $.canvasScroll(option);
// 数据数轴
$('#p2').text('购物');
var option = {
// 数轴数据 数组为枚举 对象为最大最小
data:["购物","旅游", "租房","装修","买车","买房","其它"],
// 元素
el:$('#canvas2'),
line:{
height:{
small:0,
big:22,
},
screenCount:80,
},
scrollMove:function(){
$('#p2').text(scroll[1].valText);
},
scrollEnd:function(){
$('#p2').text(scroll[1].valText);
}
}
scroll[1] = $.canvasScroll(option);
})(window.Zepto);
</script>
</body>
</html>