blob: 6c1d113eadeccf3d90e5888c494026d1ee825d1e (
plain)
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
|
<!DOCTYPE html>
<html>
<!--
Copyright 2010 The Closure Library Authors. All Rights Reserved.
Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<head>
<title>goog.ui.TwoThumbSlider</title>
<script src="../base.js"></script>
<script>
goog.require('goog.dom');
goog.require('goog.ui.Component');
goog.require('goog.ui.TwoThumbSlider');
</script>
<style>
.goog-twothumbslider-vertical,
.goog-twothumbslider-horizontal {
background-color: ThreeDFace;
position: relative;
overflow: hidden;
}
.goog-twothumbslider-value-thumb {
position: absolute;
background-color: ThreeDShadow;
overflow: hidden;
}
.goog-twothumbslider-extent-thumb {
position: absolute;
background-color: #FF0000;
overflow: hidden;
}
.goog-twothumbslider-vertical .goog-twothumbslider-value-thumb {
height: 20px;
width: 100%;
}
.goog-twothumbslider-vertical .goog-twothumbslider-extent-thumb {
height: 20px;
width: 100%;
}
.goog-twothumbslider-horizontal .goog-twothumbslider-value-thumb {
width: 20px;
height: 100%;
}
.goog-twothumbslider-horizontal .goog-twothumbslider-extent-thumb {
height: 20px;
width: 20px;
}
#s-h {
margin-bottom: 2em;
}
#out1, #out2 {
color: #999;
margin-left: 1em;
}
</style>
</head>
<body>
<h1>goog.ui.TwoThumbSlider</h1>
<div id="s-h">
<div id="s1" class="goog-twothumbslider" style="width: 200px; height: 20px">
<!-- this line is here just to show that custom content can be added -->
<div style="position:absolute;width:100%;top:9px;border:1px inset white;
overflow:hidden;height:0"></div>
<div class="goog-twothumbslider-value-thumb"></div>
<div class="goog-twothumbslider-extent-thumb"></div>
</div>
<label>
<input type="checkbox" onclick="s.setMoveToPointEnabled(this.checked)">
MoveToPointEnabled
<span id="out1"></span>
</label>
</div>
<div id="s-v">
<!-- slider inserted using scripting -->
<label id="s2-label">
<input type="checkbox" onclick="s2.setMoveToPointEnabled(this.checked)">
MoveToPointEnabled
<span id="out2"></span>
</label>
</div>
<script>
var el = document.getElementById('s1');
var s = new goog.ui.TwoThumbSlider;
s.decorate(el);
s.addEventListener(goog.ui.Component.EventType.CHANGE, function() {
document.getElementById('out1').innerHTML = 'start: ' + s.getValue() +
' end: ' + (s.getValue() + s.getExtent());
});
var s2 = new goog.ui.TwoThumbSlider;
s2.setOrientation(goog.ui.SliderBase.Orientation.VERTICAL);
s2.createDom();
var el = s2.getElement();
el.style.width = '20px';
el.style.height = '200px';
s2.render(document.body);
s2.setStep(null);
s2.addEventListener(goog.ui.Component.EventType.CHANGE, function() {
document.getElementById('out2').innerHTML = 'start: ' + s2.getValue() +
' end: ' + (s2.getValue() + s2.getExtent());
});
var label = document.getElementById('s2-label');
label.parentNode.insertBefore(el, label);
</script>
</body>
</html>
|