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 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
|
<!DOCTYPE html>
<html>
<head>
<title>goog.fx.Dragger</title>
<meta charset="utf-8">
<link rel="stylesheet" href="css/demo.css">
<script src="../base.js"></script>
<script>
goog.require('goog.fx.Dragger');
goog.require('goog.dom');
goog.require('goog.style');
</script>
<style>
#frame {
position: absolute;
left: 99px;
top: 99px;
width: 802px;
height: 502px;
border: 1px solid #999;
background-color: #F0F0F0;
}
.window {
position:absolute;
left: 150px;
top: 110px;
width: 300px;
height: 100px;
background-color: rgb(200,200,250);
border: 1px solid #99F;
font: bold 11px/18px arial;
text-indent: 10px;
color: #FFF;
}
#win2 {
top:250px;
background-color: rgb(250,200,200);
border: 1px solid #F99;
}
#win3 {
left:500px;
background-color: rgb(150,200,150);
border: 1px solid #6A6;
}
.bar {
position:absolute;
left: 0px;
top: 0px;
width: 300px;
height: 20px;
background-color: #99F;
cursor: default;
}
#win2 .bar { background-color: #F99; }
#win3 .bar { background-color: #6A6; }
#sliderback {
position: absolute;
left: 50px;
top: 98px;
height: 505px;
width: 1px;
font-size: 1px;
background-color: #999;
}
#slider {
position: absolute;
left: 35px;
top: 98px;
width: 30px;
height: 13px;
font: normal 10px verdana;
background-color: #EEE;
color: #000;
text-align:center;
border: 1px solid #999;
cursor: default;
}
#ghostbox {
position: absolute;
left: 100px;
top: 625px;
width: 600px;
height: 20px;
}
.block {
position: absolute;
left: 0px;
top: 0px;
width: 125px;
height: 20px;
font: bold 11px/18px arial;
background-color: #AAA;
color: #EEE;
text-align: center;
border: 1px solid #666;
}
.ghost0 { left: 0px; }
.ghost1 { left: 130px; }
.ghost2 { left: 260px; }
.ghost3 { left: 390px; }
</style>
</head>
<body>
<h1>goog.fx.Dragger</h1>
<p><strong>Demonstrations of the drag utiities</strong>.</p>
<div id="frame"></div>
<div id="win1" class="window"><div class="bar">Drag Me...</div></div>
<div id="win2" class="window"><div class="bar">Drag Me...</div></div>
<div id="win3" class="window"><div class="bar">Drag Me...</div></div>
<div id="sliderback"></div>
<div id="slider">0</div>
<script>
var $ = goog.dom.getElement;
// WINDOW EXAMPLE
//================
var Z = 5;
var limits = new goog.math.Rect(100, 100, 500, 400) ;
var window1 = new goog.fx.Dragger($('win1'), $('win1').firstChild, limits);
var window2 = new goog.fx.Dragger($('win2'), $('win2').firstChild, limits);
var window3 = new goog.fx.Dragger($('win3'), $('win3').firstChild);
window3.setHysteresis(6);
function setZ(e) {
this.target.style.zIndex = Z++;
goog.style.setOpacity(this.target, 0.50);
}
function end(e) {
goog.style.setOpacity(this.target, 1);
}
goog.events.listen(window1, 'start', setZ);
goog.events.listen(window2, 'start', setZ);
goog.events.listen(window3, 'start', setZ);
goog.events.listen(window1, 'end', end);
goog.events.listen(window2, 'end', end);
goog.events.listen(window3, 'end', end);
// SLIDER EXAMPLE
//================
var slider1 = new goog.fx.Dragger($('slider'), null,
new goog.math.Rect(35, 98, 0, 490));
goog.events.listen(slider1, 'drag', function(e) {
var percent = Math.round(100 * (e.top - e.dragger.limits.top) /
e.dragger.limits.height);
$('slider').innerHTML = percent;
});
goog.events.listen(window, 'unload', function(e) {
window1.dispose();
window2.dispose();
window3.dispose();
slider1.dispose();
});
</script>
</body>
</html>
<!--
Copyright 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.
-->
|