-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
133 lines (119 loc) · 4.06 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
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title></title>
<script data-require="jquery" data-semver="2.1.1" src="jquery.min.js"></script>
<!-- <script data-require="jquery" data-semver="2.1.1" src="jquery-1.7.2.min.js"></script>-->
<script src="jquery-segmented-picker.js"></script>
<link rel="stylesheet" type="text/css" href="jquery-segment-picker.css"/>
<script type="text/javascript">
$(function ()
{
$('#nospin').segmentPicker({
segments: [{ min: 0, max: 9 }, "-", { min: 00, max: 99 }, "-", { min: 000, max: 999 }, "-", { min: 0000, max: 9999 }],
onBlur: function( segments)
{
$("#RepVal").text($(this).val());
},
showSpinner: false
});
$('#12h-picker').segmentPicker({
segments: [{min: 1, max: 12}, ":", {min: 0, max: 59}, " ", ["am", "pm"]],
onIncrement: function(newVal, oldVal, segments, selectedSegment)
{
if(selectedSegment == 0 && oldVal == "11" && newVal == "12")
segments[4].increment();
else if(selectedSegment == 2 && oldVal == "59" && newVal == "00")
segments[0].increment()
},
onDecrement: function(newVal, oldVal, segments, selectedSegment){
if(selectedSegment == 0 && oldVal == "12" && newVal == "11")
segments[4].decrement();
else if(selectedSegment == 2 && oldVal == "00" && newVal == "59")
segments[0].decrement()
}
});
$('#24h-picker').segmentPicker({
segments: [{min: 0, max: 23}, ":", {min: 0, max: 59}],
onIncrement: function(newVal, oldVal, segments, selectedSegment)
{
if(selectedSegment == 2 && oldVal == "59" && newVal == "00")
segments[0].increment()
},
onDecrement: function(newVal, oldVal, segments, selectedSegment){
if(selectedSegment == 2 && oldVal == "00" && newVal == "59")
segments[0].decrement()
}
});
$('#duration-picker').segmentPicker({
segments: [{min: 0, max: 24}, "h ", {min: 0, max: 59}, "m"]
});
$('#currency-picker').segmentPicker({
segments: [{min: 1, max: 24}, ".", {min: 0, max: 99}, " ", ["USD", "EUR"]]
});
$('#speed-picker').segmentPicker({
segments: [{min: 0, max: 999}, ".", {min: 0, max: 99}, " km/h"]
}).on('change keyup', function ()
{
console.log('$(this).val()', $(this).val());
});
});
</script>
<style>
body{
font-family: "Helvetica Neue", Helvetica, 'Segoe UI', Arial, sans-serif;
}
div
{
margin: 15px;
}
</style>
</head>
<body>
<div>
<label>
Speed picker
<input type="text" id="speed-picker" value="123.23 km/h" style="
height: 35px;
box-sizing: border-box;"/>
</label>
</div>
<div>
<label>
12h time picker
<input type="text" id="12h-picker" value="12:30 pm" style="font-size: 20px"/>
</label>
</div>
<div>
<label>
24h time picker
<input type="text" id="24h-picker" value="19:00" style="padding: 10px"/>
</label>
</div>
<div>
<label>
Duration picker - for stoppers etc.
<input type="text" id="duration-picker" value="12h 17m" style="margin:10px"/>
</label>
</div>
<div>
<label>
Currency picker
<input type="text" id="currency-picker" value="12.99 USD"/>
</label>
</div>
<div>
<label>
No Spinner
<input type="text" id="nospin" value="1-01-001-0001"/>
</label>
</div>
<div>
<label>
Reported value:
</label>
<span id="RepVal">...</span>
</div>
</body>
</html>