| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<!-- |
| 4 |
Copyright 2010 The Closure Library Authors. All Rights Reserved. |
| 5 |
|
| 6 |
Use of this source code is governed by the Apache License, Version 2.0. |
| 7 |
See the COPYING file for details. |
| 8 |
--> |
| 9 |
<head> |
| 10 |
<title>goog.ui.TwoThumbSlider</title> |
| 11 |
<script src="../base.js"></script> |
| 12 |
<script> |
| 13 |
goog.require('goog.dom'); |
| 14 |
goog.require('goog.ui.Component'); |
| 15 |
goog.require('goog.ui.TwoThumbSlider'); |
| 16 |
</script> |
| 17 |
<style> |
| 18 |
|
| 19 |
.goog-twothumbslider-vertical, |
| 20 |
.goog-twothumbslider-horizontal { |
| 21 |
background-color: ThreeDFace; |
| 22 |
position: relative; |
| 23 |
overflow: hidden; |
| 24 |
} |
| 25 |
|
| 26 |
.goog-twothumbslider-value-thumb { |
| 27 |
position: absolute; |
| 28 |
background-color: ThreeDShadow; |
| 29 |
overflow: hidden; |
| 30 |
} |
| 31 |
|
| 32 |
.goog-twothumbslider-extent-thumb { |
| 33 |
position: absolute; |
| 34 |
background-color: #FF0000; |
| 35 |
overflow: hidden; |
| 36 |
} |
| 37 |
|
| 38 |
.goog-twothumbslider-vertical .goog-twothumbslider-value-thumb { |
| 39 |
height: 20px; |
| 40 |
width: 100%; |
| 41 |
} |
| 42 |
|
| 43 |
.goog-twothumbslider-vertical .goog-twothumbslider-extent-thumb { |
| 44 |
height: 20px; |
| 45 |
width: 100%; |
| 46 |
} |
| 47 |
|
| 48 |
.goog-twothumbslider-horizontal .goog-twothumbslider-value-thumb { |
| 49 |
width: 20px; |
| 50 |
height: 100%; |
| 51 |
} |
| 52 |
|
| 53 |
.goog-twothumbslider-horizontal .goog-twothumbslider-extent-thumb { |
| 54 |
height: 20px; |
| 55 |
width: 20px; |
| 56 |
} |
| 57 |
#s-h { |
| 58 |
margin-bottom: 2em; |
| 59 |
} |
| 60 |
#out1, #out2 { |
| 61 |
color: #999; |
| 62 |
margin-left: 1em; |
| 63 |
} |
| 64 |
</style> |
| 65 |
</head> |
| 66 |
<body> |
| 67 |
<h1>goog.ui.TwoThumbSlider</h1> |
| 68 |
<div id="s-h"> |
| 69 |
<div id="s1" class="goog-twothumbslider" style="width: 200px; height: 20px"> |
| 70 |
<!-- this line is here just to show that custom content can be added --> |
| 71 |
<div style="position:absolute;width:100%;top:9px;border:1px inset white; |
| 72 |
overflow:hidden;height:0"></div> |
| 73 |
<div class="goog-twothumbslider-value-thumb"></div> |
| 74 |
<div class="goog-twothumbslider-extent-thumb"></div> |
| 75 |
</div> |
| 76 |
<label> |
| 77 |
<input type="checkbox" onclick="s.setMoveToPointEnabled(this.checked)"> |
| 78 |
MoveToPointEnabled |
| 79 |
<span id="out1"></span> |
| 80 |
</label> |
| 81 |
</div> |
| 82 |
|
| 83 |
<div id="s-v"> |
| 84 |
<!-- slider inserted using scripting --> |
| 85 |
<label id="s2-label"> |
| 86 |
<input type="checkbox" onclick="s2.setMoveToPointEnabled(this.checked)"> |
| 87 |
MoveToPointEnabled |
| 88 |
<span id="out2"></span> |
| 89 |
</label> |
| 90 |
</div> |
| 91 |
|
| 92 |
<script> |
| 93 |
|
| 94 |
var el = document.getElementById('s1'); |
| 95 |
var s = new goog.ui.TwoThumbSlider; |
| 96 |
s.decorate(el); |
| 97 |
s.addEventListener(goog.ui.Component.EventType.CHANGE, function() { |
| 98 |
document.getElementById('out1').innerHTML = 'start: ' + s.getValue() + |
| 99 |
' end: ' + (s.getValue() + s.getExtent()); |
| 100 |
}); |
| 101 |
|
| 102 |
|
| 103 |
var s2 = new goog.ui.TwoThumbSlider; |
| 104 |
s2.setOrientation(goog.ui.SliderBase.Orientation.VERTICAL); |
| 105 |
s2.createDom(); |
| 106 |
var el = s2.getElement(); |
| 107 |
el.style.width = '20px'; |
| 108 |
el.style.height = '200px'; |
| 109 |
s2.render(document.body); |
| 110 |
s2.setStep(null); |
| 111 |
s2.addEventListener(goog.ui.Component.EventType.CHANGE, function() { |
| 112 |
document.getElementById('out2').innerHTML = 'start: ' + s2.getValue() + |
| 113 |
' end: ' + (s2.getValue() + s2.getExtent()); |
| 114 |
}); |
| 115 |
|
| 116 |
var label = document.getElementById('s2-label'); |
| 117 |
label.parentNode.insertBefore(el, label); |
| 118 |
|
| 119 |
</script> |
| 120 |
</body> |
| 121 |
</html> |