-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflicks.html
More file actions
233 lines (230 loc) · 24.5 KB
/
flicks.html
File metadata and controls
233 lines (230 loc) · 24.5 KB
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<title>Flicks</title>
<style type="text/css" media="all">
html, body { height:100%; margin:0; width:100%; }
body { font:13.5px/1.184 helvetica,arial,freesans,sans-serif; }
.col { float:left; height:100%; width:74%; }
.col.right { width:26%; }
.clip { height:100%; width:100%; overflow:hidden; position:relative; }
.dragpad, .draggable { cursor:pointer; height:100%; position:absolute; left:0; top:0; }
.dragpad, .zoomable { width:100%; }
#map-clip { height:80%; }
#map { display:block; }
#list-clip { height:70px; }
ul { list-style-type:none; margin:0; padding:0; white-space:nowrap; }
li { box-sizing:border-box; -moz-box-sizing:border-box; -webkit-box-sizing:border-box; display:inline-block; }
#list-v, #list-v>li { margin:0; height:auto; width:100%; }
#list-v>li { border:1px solid #000; display:block; padding:1em; }
</style>
</head>
<body>
<div class="col">
<div id="map-clip" class="clip">
<img class="draggable zoomable" id="map" src="img/clear_blue_sky_label.jpg" />
</div>
<div id="list-clip" class="clip">
<ul class="draggable" id="list"><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AC/2006AC5746_jpg_s.jpg" alt="Chair" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2008BR/2008BR9185_jpg_s.jpg" alt="Vase" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2010EA/2010EA7377_jpg_s.jpg" alt="Poster" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AM/2006AM7100_jpg_s.jpg" alt="Design" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AM/2006AM2862_jpg_s.jpg" alt="Engraving" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2009CT/2009CT1962_jpg_s.jpg" alt="H Beard Print Collection (Print)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AP/2006AP9141_jpg_s.jpg" alt="Open Landscape with Shepherd, Sheep, Pool and Distant Hills (Oil painting)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2008BU/2008BU3026_jpg_s.jpg" alt="Scenes of a Marriage Ceremony (cassone panel) (Cassone panel)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2010EG/2010EG0492_jpg_s.jpg" alt="H Beard Print Collection (Print)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006BA/2006BA0945_jpg_s.jpg" alt="Smoking table" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AT/2006AT4261_jpg_s.jpg" alt="British and Foreign Animals, A New Game, Moral, Instructive, and Amusing (Board game)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AU/2006AU9235_jpg_s.jpg" alt="Snuff bottle" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AW/2006AW3391_jpg_s.jpg" alt="View from palace in fort, Lahore (Photograph)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2009BY/2009BY0649_jpg_s.jpg" alt="Guy Little Theatrical Photograph (Photograph)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2009BX/2009BX9101_jpg_s.jpg" alt="Guy Little Theatrical Photograph (Photograph)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2007BL/2007BL8897_jpg_s.jpg" alt="The Munduramiar Mundapam (Photograph)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006BG/2006BG6915_jpg_s.jpg" alt="Locket" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AT/2006AT1108_jpg_s.jpg" alt="Clock" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2009BY/2009BY2731_jpg_s.jpg" alt="Guy Little Theatrical Photograph (Photograph)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AU/2006AU9488_jpg_s.jpg" alt="Snuff bottle" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AC/2006AC5746_jpg_s.jpg" alt="Chair" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2008BR/2008BR9185_jpg_s.jpg" alt="Vase" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2010EA/2010EA7377_jpg_s.jpg" alt="Poster" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AM/2006AM7100_jpg_s.jpg" alt="Design" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AM/2006AM2862_jpg_s.jpg" alt="Engraving" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2009CT/2009CT1962_jpg_s.jpg" alt="H Beard Print Collection (Print)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AP/2006AP9141_jpg_s.jpg" alt="Open Landscape with Shepherd, Sheep, Pool and Distant Hills (Oil painting)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2008BU/2008BU3026_jpg_s.jpg" alt="Scenes of a Marriage Ceremony (cassone panel) (Cassone panel)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2010EG/2010EG0492_jpg_s.jpg" alt="H Beard Print Collection (Print)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006BA/2006BA0945_jpg_s.jpg" alt="Smoking table" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AT/2006AT4261_jpg_s.jpg" alt="British and Foreign Animals, A New Game, Moral, Instructive, and Amusing (Board game)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AU/2006AU9235_jpg_s.jpg" alt="Snuff bottle" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AW/2006AW3391_jpg_s.jpg" alt="View from palace in fort, Lahore (Photograph)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2009BY/2009BY0649_jpg_s.jpg" alt="Guy Little Theatrical Photograph (Photograph)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2009BX/2009BX9101_jpg_s.jpg" alt="Guy Little Theatrical Photograph (Photograph)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2007BL/2007BL8897_jpg_s.jpg" alt="The Munduramiar Mundapam (Photograph)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006BG/2006BG6915_jpg_s.jpg" alt="Locket" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AT/2006AT1108_jpg_s.jpg" alt="Clock" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2009BY/2009BY2731_jpg_s.jpg" alt="Guy Little Theatrical Photograph (Photograph)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AU/2006AU9488_jpg_s.jpg" alt="Snuff bottle" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AC/2006AC5746_jpg_s.jpg" alt="Chair" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2008BR/2008BR9185_jpg_s.jpg" alt="Vase" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2010EA/2010EA7377_jpg_s.jpg" alt="Poster" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AM/2006AM7100_jpg_s.jpg" alt="Design" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AM/2006AM2862_jpg_s.jpg" alt="Engraving" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2009CT/2009CT1962_jpg_s.jpg" alt="H Beard Print Collection (Print)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AP/2006AP9141_jpg_s.jpg" alt="Open Landscape with Shepherd, Sheep, Pool and Distant Hills (Oil painting)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2008BU/2008BU3026_jpg_s.jpg" alt="Scenes of a Marriage Ceremony (cassone panel) (Cassone panel)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2010EG/2010EG0492_jpg_s.jpg" alt="H Beard Print Collection (Print)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006BA/2006BA0945_jpg_s.jpg" alt="Smoking table" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AT/2006AT4261_jpg_s.jpg" alt="British and Foreign Animals, A New Game, Moral, Instructive, and Amusing (Board game)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AU/2006AU9235_jpg_s.jpg" alt="Snuff bottle" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AW/2006AW3391_jpg_s.jpg" alt="View from palace in fort, Lahore (Photograph)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2009BY/2009BY0649_jpg_s.jpg" alt="Guy Little Theatrical Photograph (Photograph)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2009BX/2009BX9101_jpg_s.jpg" alt="Guy Little Theatrical Photograph (Photograph)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2007BL/2007BL8897_jpg_s.jpg" alt="The Munduramiar Mundapam (Photograph)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006BG/2006BG6915_jpg_s.jpg" alt="Locket" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AT/2006AT1108_jpg_s.jpg" alt="Clock" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2009BY/2009BY2731_jpg_s.jpg" alt="Guy Little Theatrical Photograph (Photograph)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AU/2006AU9488_jpg_s.jpg" alt="Snuff bottle" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AC/2006AC5746_jpg_s.jpg" alt="Chair" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2008BR/2008BR9185_jpg_s.jpg" alt="Vase" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2010EA/2010EA7377_jpg_s.jpg" alt="Poster" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AM/2006AM7100_jpg_s.jpg" alt="Design" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AM/2006AM2862_jpg_s.jpg" alt="Engraving" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2009CT/2009CT1962_jpg_s.jpg" alt="H Beard Print Collection (Print)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AP/2006AP9141_jpg_s.jpg" alt="Open Landscape with Shepherd, Sheep, Pool and Distant Hills (Oil painting)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2008BU/2008BU3026_jpg_s.jpg" alt="Scenes of a Marriage Ceremony (cassone panel) (Cassone panel)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2010EG/2010EG0492_jpg_s.jpg" alt="H Beard Print Collection (Print)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006BA/2006BA0945_jpg_s.jpg" alt="Smoking table" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AT/2006AT4261_jpg_s.jpg" alt="British and Foreign Animals, A New Game, Moral, Instructive, and Amusing (Board game)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AU/2006AU9235_jpg_s.jpg" alt="Snuff bottle" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AW/2006AW3391_jpg_s.jpg" alt="View from palace in fort, Lahore (Photograph)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2009BY/2009BY0649_jpg_s.jpg" alt="Guy Little Theatrical Photograph (Photograph)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2009BX/2009BX9101_jpg_s.jpg" alt="Guy Little Theatrical Photograph (Photograph)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2007BL/2007BL8897_jpg_s.jpg" alt="The Munduramiar Mundapam (Photograph)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006BG/2006BG6915_jpg_s.jpg" alt="Locket" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AT/2006AT1108_jpg_s.jpg" alt="Clock" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2009BY/2009BY2731_jpg_s.jpg" alt="Guy Little Theatrical Photograph (Photograph)" height="70" width="70"></li><li><img src="http://media.vam.ac.uk/media/thira/collection_images/2006AU/2006AU9488_jpg_s.jpg" alt="Snuff bottle" height="70" width="70"></li></ul>
</div>
</div>
<div class="col right">
<div id="list-v-clip" class="clip">
<ul class="draggable" id="list-v"><li>ITEM 1</li><li>ITEM 2</li><li>ITEM 3</li><li>ITEM 4</li><li>ITEM 5</li><li>ITEM 6</li><li>ITEM 7</li><li>ITEM 8</li><li>ITEM 9</li><li>ITEM 10</li><li>ITEM 11</li><li>ITEM 12</li><li>ITEM 13</li><li>ITEM 14</li><li>ITEM 15</li><li>ITEM 16</li><li>ITEM 17</li><li>ITEM 18</li><li>ITEM 19</li><li>ITEM 20</li><li>ITEM 21</li><li>ITEM 22</li><li>ITEM 23</li></ul>
</div>
</div>
<script type="text/javascript">
function addHandler(el,evt,fn){ if( el.addEventListener ){ el.addEventListener(evt,fn,false); }else if( el.attachEvent ){ el.attachEvent('on'+evt,fn); } }
function rmHandler(el,evt,fn){ if( el.removeEventListener ){el.removeEventListener(evt,fn,false); }else if( el.detachEvent ){ el.detachEvent('on'+evt,fn); } }
function getComputed(el,style){ if(window.getComputedStyle){ var y=document.defaultView.getComputedStyle(el,null).getPropertyValue(style); }else if(el.currentStyle){ if( style=='width' ){ y=el.getBoundingClientRect().right-el.getBoundingClientRect().left }else if( style=='height' ){ y=el.getBoundingClientRect().bottom-el.getBoundingClientRect().top }else{ var y=el.currentStyle[style] } } return parseFloat(y); }
function getPgOffset(el){ var o=[0,0]; if( el.offsetParent ){ do{ o=[o[0]+el.offsetLeft,o[1]+el.offsetTop]; }while( el=el.offsetParent ) } return [o[0]+document.body.scrollLeft,o[1]+document.body.scrollTop]; }
function getXY(e){ var xy=[]; if( e.touches && e.touches.length ){ if( e.touches.length>1 ){ xy[0] = (e.touches[0].pageX+e.touches[0].pageX)/2; xy[1] = (e.touches[0].pageY+e.touches[0].pageY)/2;}else{ xy[0] = e.touches[0].pageX; xy[1] = e.touches[0].pageY; } }else{ xy[0] = e.pageX; xy[1] = e.pageY; } return xy; }
var dragZoom;
dragZoom = {
el:null, xy0:null, v0:null, xyT:null, xyE:null, d0:null, targ:null, dt:null, t:null,
init: function(el){
if(typeof el==='string'){ el = document.getElementById(el); }
var zoomer = el.nodeName.toLowerCase()==='svg'?el.className.baseVal:el.className, zoomer = String(zoomer).indexOf('zoomable')>-1;
el.P = el.parentNode;
if( !el.nextSibling ){ el.trig = document.createElement('div'); el.trig.setAttribute('class', 'dragpad'); el.P.appendChild(el.trig) }else{ if( el.nextSibling.className==='dragpad' ){ el.trig = el.nextSibling; }else{ el.trig = document.createElement('div'); el.trig.setAttribute('class', 'dragpad'); el.P.insertBefore(el.trig, el.nextSibling); } }
el.trig.onmousedown = dragZoom.touch;
el.trig.ontouchstart = dragZoom.touch;
if( window.addEventListener ){
el.trig.addEventListener('DOMMouseScroll', dragZoom.touch, false);
el.trig.addEventListener('mousewheel', dragZoom.touch, false);
}else if( window.attachEvent ){
el.trig.attachEvent('onmousewheel', dragZoom.touch);
}
el.xy = [getComputed(el,'left'), getComputed(el,'top')];
el.v = [0,0];
el.wh = [getComputed(el,'width'), getComputed(el,'height')];
el.xyP = getPgOffset(el.P);
el.whP = [getComputed(el.P,'width'), getComputed(el.P,'height')];
el.whP0 = el.whP;
el.zoomer = zoomer||null;
if( !el.move ){
el.move = function(xy){
if( this.wh[0]>this.whP[0] || this.wh[1]>this.whP[1] ){
var x=xy[0], y=xy[1], r;
if( x>0 ){ x=0; r = this.wh[0]>this.whP[0]? [1,0]:null; }
else if( x<this.whP[0]-this.wh[0] ){ x=this.whP[0]-this.wh[0]; r = this.wh[0]>this.whP[0]? [-1,0]:null; }
if( y>0 ){ y=0; r = this.wh[1]>this.whP[1]? [0,1]:r; }
else if( y<this.whP[1]-this.wh[1] ){ y=this.whP[1]-this.wh[1]; r = this.wh[1]>this.whP[1]? [0,-1]:r; }
this.xy = [x,y];
this.style.left = x+'px';
this.style.top = y+'px';
return r;
}
};
el.drop = function(){
var f = Math.abs(this.v[0])+Math.abs(this.v[1])>50?0.98:0.88, r;
this.v = [this.v[0]*f, this.v[1]*f];
this.xy = [this.xy[0]+this.v[0], this.xy[1]+this.v[1]];
r = this.move(this.xy);
if( r ){
if( r[0] ){ this.v = [-this.v[0]*f, this.v[1]*f]; }
if( r[1] ){ this.v = [this.v[0]*f, -this.v[1]*f]; }
}
if( Math.abs(this.v[0])+Math.abs(this.v[1])<0.5 ){ window.clearTimeout(this.t); return; }
this.t = window.setTimeout(function(){ el.drop(); }, 23);
};
if( el.zoomer ){
el.zoom = function(z,xy0){
xy0 = xy0 || [this.whP[0]/2, this.whP[1]/2];
if( z>1 && this.wh[0]>2048 ){ return; }
if( this.wh[0]*z>this.whP[0] || this.wh[1]*z>this.whP[1] ){
this.wh = [this.wh[0]*z,this.wh[1]*z];
this.style.width = this.wh[0]+'px';
this.style.height = this.wh[1]+'px';
this.move([(xy0[0]-((xy0[0]-this.xy[0])*z)),(xy0[1]-((xy0[1]-this.xy[1])*z))]);
}else{
this.style.width = this.style.height = '100%';
this.wh = [getComputed(el,'width'), getComputed(el,'height')];
this.style.left = this.style.top = 0;
this.xy = [0,0];
}
};
el.zoom0 = function(){
var c = 0;
if( this.t ){ window.clearInterval(this.t); }
this.t = window.setInterval(function(){ el.zoom(0.92+0.07*(1-Math.pow(1-(++c/1000),5))); if( el.style.width==='100%' ){ window.clearInterval(el.t); }},1);
};
}
}
},
touch: function(e){
e = e || window.event;
if( e.type==='touchstart' && e.touches && e.touches.length>2 ){ return; }
dragZoom.el = this.parentNode.querySelector('.draggable');
window.clearTimeout(dragZoom.el.t);
dragZoom.v0 = dragZoom.el.v;
dragZoom.el.v = [0,0];
dragZoom.xy0 = dragZoom.el.xy;
dragZoom.xyT = getXY(e);
this.style.display = 'none'; dragZoom.targ = document.elementFromPoint(dragZoom.xyT[0]-(window.scrollX?window.scrollX:document.body.scrollLeft),dragZoom.xyT[1]-(window.scrollY?window.scrollY:document.body.scrollTop)); this.style.display = 'block';
if( dragZoom.el.zoomer ){
var dt0 = dragZoom.dt, dt = new Date().getTime();
dragZoom.dt = dt;
if( dt0 && dt-dt0<250 ){
window.clearTimeout(dragZoom.t);
dragZoom.zoom(e,1);
return;
}
}
if( e.type==='touchstart' ){
if( dragZoom.el.zoomer && e.touches && e.touches.length===2 ){
dragZoom.d0 = Math.sqrt(Math.pow(e.touches[0].pageX-e.touches[1].pageX,2)+Math.pow(e.touches[0].pageY-e.touches[1].pageY,2));
dragZoom.el.trig.ontouchmove = dragZoom.zoom;
}else{
dragZoom.el.trig.ontouchmove = dragZoom.drag;
}
dragZoom.el.trig.onmousedown = null;
dragZoom.el.trig.ontouchend = function(){
dragZoom.el.trig.ontouchmove = null;
dragZoom.el.trig.ontouchend = null;
dragZoom.release();
};
}else{
if( e.type==='DOMMouseScroll' || e.type==='mousewheel' ){
if( dragZoom.el.zoomer ){ dragZoom.zoom(e); }
}else{
document.onmousemove = dragZoom.drag;
document.onmouseup = function(){
document.onmousemove = null;
document.onmouseup = null;
dragZoom.release();
};
}
}
return false;
},
drag: function(e){
e = e || window.event;
dragZoom.xyE = getXY(e);
var xy = [dragZoom.xy0[0]+dragZoom.xyE[0]-dragZoom.xyT[0], dragZoom.xy0[1]+dragZoom.xyE[1]-dragZoom.xyT[1]];
dragZoom.el.v = [(xy[0]-dragZoom.el.xy[0]),(xy[1]-dragZoom.el.xy[1])];
dragZoom.el.move(xy);
return false;
},
release: function(){
if( ((!dragZoom.xyE && !dragZoom.d0) || (!!dragZoom.xyE && Math.abs(dragZoom.xyT[0]-dragZoom.xyE[0])<5 && Math.abs(dragZoom.xyT[1]-dragZoom.xyE[1])<5)) && Math.abs(dragZoom.v0[0])+Math.abs(dragZoom.v0[1])<2 ){
var passclick = function(){
var evt = document.createEvent("HTMLEvents");
evt.initEvent("click", true, false);
dragZoom.targ.dispatchEvent(evt);
}
if(dragZoom.el.zoomer ){ dragZoom.t = window.setTimeout(passclick,100); }else{ passclick(); }
}else{
dragZoom.el.drop();
}
dragZoom.el = dragZoom.xyE = dragZoom.d0 = null;
},
zoom: function(e,zz){
e = e || window.event;
if( e.preventDefault ){ e.preventDefault(); }else{ e.returnValue=false; }
var z, d1, xy0 = [dragZoom.xyT[0]-dragZoom.el.xyP[0],dragZoom.xyT[1]-dragZoom.el.xyP[1]];
if( zz ){
z = dragZoom.el.wh[0]>=dragZoom.el.whP[0]*2 ? 0:2;
}else if( e.touches ){
d1 = Math.sqrt(Math.pow(e.touches[0].pageX-e.touches[1].pageX,2)+Math.pow(e.touches[0].pageY-e.touches[1].pageY,2));
z = 1+((d1-dragZoom.d0>0?1:-1.5)*0.05);
dragZoom.d0 = d1;
}else{
z = (e.detail? e.detail*-1 : e.wheelDelta/40);
z = 1+((z>0?1:-1)*0.25);
}
dragZoom.el.zoom(z,xy0);
return false;
}
};
var draggables = document.querySelectorAll('.draggable');
for( var i=0; i<draggables.length; ++i ){
dragZoom.init(draggables[i]);
}
addHandler(window,'resize',function(){
for( var i=0; i<draggables.length; ++i ){
var el = draggables[i];
el.whP = [getComputed(el.P,'width'), getComputed(el.P,'height')];
el.wh = [getComputed(el,'width'), getComputed(el,'height')];
el.xyP = getPgOffset(el.P);
if( el.wh[0]<el.whP[0] || el.wh[1]<el.whP[1] ){
el.zoom0();
}else if( el.wh[0]!=='100%' ){
el.move([el.xy[0]+((el.whP[0]-el.whP0[0])/2), el.xy[1]+((el.whP[1]-el.whP0[1])/2)]);
el.whP0 = el.whP;
if( el.nodeName.toLowerCase()==='svg' ){ //update w/h explicitly for SVGs
el.style.width = getComputed(el,'width')+'px';
el.style.height = getComputed(el,'height')+'px';
}
}
}
});
var lis = document.querySelectorAll('li');
for( var i=0; i<lis.length; ++i ){
addHandler(lis[i],'click',function(){ this.style.opacity = getComputed(this,'opacity')===1? 0.3:1; });
}
</script>
</body>
</html>