-
Notifications
You must be signed in to change notification settings - Fork 11
/
demo.html
594 lines (497 loc) · 22.3 KB
/
demo.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
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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8"/>
<title>jQuery Splitter Demo</title>
<meta name="Description" content="jQuery Splitter Demo"/>
<link rel="shortcut icon" href=""/>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="js/jquery.enhsplitter.js"></script>
<link href="css/jquery.enhsplitter.css" rel="stylesheet"/>
<!--[if IE]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
body {
font: normal 13px Arial, Helvetica, sans-serif;
margin: 1em;
}
#code {
position: absolute;
top: 1em;
right: 1em;
width: 45%;
}
hr {
border-top: 3px solid black;
height: 0;
}
#docs {
padding: 2em;
font: normal 14px Calibri, Arial, Helvetica, sans-serif;
}
dt {
font: bold 14px Consolas, "Courier New", Courier, mono;
color: steelblue;
background-color: #f0f0f0;
margin-top: 1.5em;
padding: 0.2em 0.5em;
}
dd {
}
dd code {
font: bold 12px Consolas, "Courier New", Courier, mono;
}
dd > code {
display: block;
color: #666666;
}
dd > code.default {
color: #007700;
}
pre.codesample {
font: bold 12px Consolas, "Courier New", Courier, mono;
background: #ffffff;
overflow: auto;
width: 75%;
border: solid gray;
border-width: .1em .1em .1em .8em;
padding: .2em .6em;
margin: 0 auto;
line-height: 125%
}
.splitter_panel > div {
padding: 0 1em;
}
#demoOne {
background-color: #e7e3ff;
width: 50%;
height: 375px;
border: 4px solid #666;
}
#demoOneA {
background-color: #e7e3ff;
}
#demoThree {
width: 50%;
height: 150px;
margin-top: 1em;
border: 4px solid silver;
}
#demoOneB {
background-color: red;
}
#demoTwoA {
background-color: #efbd73;
}
#demoTwoB {
background-color: #ef9e92;
}
#demoThree {
background-color: #BEE927
}
#demoThreeA {
background-color: #fafafa;
}
#demoThreeB {
background-color: #f6f6f6;
}
</style>
<script>
jQuery(function ($) {
$('#demoOne').enhsplitter({minSize: 50, vertical: false});
$('#demoOneB').enhsplitter();
$('#demoThree').enhsplitter({handle: 'bar', position: 150, leftMinSize: 0, fixed: true});
});
</script>
</head>
<body>
<div id="demoOne">
<div id="demoOneA">
<h4>#demoOneA</h4>
<p>
Welcome to the demo page for <code>hiltonjanfield/jquery.enhsplitter</code>.
</p>
<p>
This splitter is set with <code>{minSize: 50, vertical: false}</code>.
This is the lower pane of the outer splitter; the two panels and splitter above are contained within the
upper panel of this splitter.
</p>
<p style="color: #888888;">
Controller feedback element software integral femtosecond element overflow integral. Or patch element
supporting mainframe software resistor floating-point development broadband, technician development
converter generator.
Encapsulated logistically kilohertz fragmentation feedback coordinated, anomoly port log read-only plasma
deviation deviation scalar. Pulse, capacitance software feedback feedback network, device overflow.
</p>
</div>
<div id="demoOneB">
<div id="demoTwoA">
<h4>#demoTwoA</h4>
<p>
This splitter was created with purely default options, resulting in a vertical splitter, 100px minimum
panel size, and a standard collapse handle.
</p>
</div>
<div id="demoTwoB">
<h4>#demoTwoB</h4>
<p style="color: #888888;">
There's a voice that keeps on calling me. Down the road, that's where I'll always be. Every stop I make,
I make a new friend. Can't stay for long, just turn around and I'm gone again. Maybe tomorrow, I'll want
to settle down, Until tomorrow, I'll just keep moving on.
</p>
</div>
</div>
</div>
<div id="demoThree">
<div id="demoThreeA">
<h4>#demoThreeA</h4>
<p>
Sidebar Example with fixed splitter.
</p>
</div>
<div id="demoThreeB">
<h4>#demoThreeB</h4>
<p>
This splitter was created using with the options <code>{handle: 'bar', position: 150, leftMinSize: 0, fixed: true}</code>. <code>position</code> defines a starting size,
<code>leftMinSize</code> defines how small the panel gets when collapsed, and
<code>handle</code> sets up a different effect for the collapse handle. The <code>{fixed: true}</code>
option disables the ability to drag the splitter around, while leaving the collapse options intact - the
combined result being an unmovable bar with a button that collapses it back and forth.
</p>
<p style="color: #888888;">
Pulse recognition metafile ethernet element prompt dithering bus system resistor deviation scalar
coordinated
transmission adaptive. Prompt reducer record deviation led silicon transmission. Floating-point port
development
plasma, led phase pulse. High, inversion, recursive, element system broadband, gigabyte extended sampling
frequency deviation data software.
</p>
</div>
</div>
<!-- Example code display. -->
<!-- HTML generated using hilite.me and slightly modified by hand -->
<pre id="code" class="codesample"><span style="color: #007700"><div</span> <span
style="color: #0000CC">id=</span><span style="background-color: #fff0f0">"demoOne"</span><span
style="color: #007700">></span>
<span style="color: #007700"><div</span> <span style="color: #0000CC">id=</span><span
style="background-color: #fff0f0">"demoOneA"</span><span style="color: #007700">></span>
[...]
<span style="color: #007700"></div></span>
<span style="color: #007700"><div</span> <span style="color: #0000CC">id=</span><span
style="background-color: #fff0f0">"demoOneB"</span><span style="color: #007700">></span>
<span style="color: #007700"><div</span> <span style="color: #0000CC">id=</span><span
style="background-color: #fff0f0">"demoTwoA"</span><span style="color: #007700">></span>
[...]
<span style="color: #007700"></div></span>
<span style="color: #007700"><div</span> <span style="color: #0000CC">id=</span><span
style="background-color: #fff0f0">"demoTwoB"</span><span style="color: #007700">></span>
[...]
<span style="color: #007700"></div></span>
<span style="color: #007700"></div></span>
<span style="color: #007700"></div></span>
<span style="color: #007700"><div</span> <span style="color: #0000CC">id=</span><span
style="background-color: #fff0f0">"demoThree"</span><span style="color: #007700">></span>
<span style="color: #007700"><div</span> <span style="color: #0000CC">id=</span><span
style="background-color: #fff0f0">"demoThreeA"</span><span style="color: #007700">></span>
[...]
<span style="color: #007700"></div></span>
<span style="color: #007700"><div</span> <span style="color: #0000CC">id=</span><span
style="background-color: #fff0f0">"demoThreeB"</span><span style="color: #007700">></span>
[...]
<span style="color: #007700"></div></span>
<span style="color: #007700"></div></span>
<span style="color: #770000"><script></span>
jQuery(<span style="color: #008800; font-weight: bold">function</span> ($) {
$(<span style="background-color: #fff0f0">'#demoOne'</span>).enhsplitter({minSize<span
style="color: #333333">:</span> <span
style="color: #0000DD; font-weight: bold">50</span>, vertical<span
style="color: #333333">:</span> <span style="background-color: #fff0f0">false</span>});
$(<span style="background-color: #fff0f0">'#demoOneB'</span>).enhsplitter();
$(<span style="background-color: #fff0f0">'#demoThree'</span>).enhsplitter({handle<span
style="color: #333333">:</span> <span
style="background-color: #fff0f0">'bar'</span>, position<span
style="color: #333333">:</span> <span
style="background-color: #fff0f0">150</span>, leftMinSize<span
style="color: #333333">:</span> <span
style="color: #0000DD; font-weight: bold">0</span>, fixed<span
style="color: #333333">:</span> <span style="color: #0000DD; font-weight: bold">true</span>});
});
<span style="color: #770000"></script></span>
</pre>
<hr>
<a href="test.html">Features test page</a>
<div id="docs">
<h1>Usage</h1>
<dl>
<dt>Basic Usage</dt>
<dd>
<p>
Three HTML elements are required at a minimum. These can theoretically be any elements, but are intended
to be DIVs or other basic block-level elements. There must be one parent element and two child
elements. Additional child elements can exist, but is not supported and will result in unintended
side effects.
</p>
<pre class="codesample"><span style="color: #007700"><div</span> <span
style="color: #0000CC">id=</span><span
style="background-color: #fff0f0">"panels"</span><span style="color: #007700">></span>
<span style="color: #007700"><div></span>
[...]
<span style="color: #007700"></div></span>
<span style="color: #007700"><div></span>
[...]
<span style="color: #007700"></div></span>
<span style="color: #007700"></div></span></pre>
<p>
Once that is in place, all you need to do is call <code>.enhsplitter()</code> on an element.
This will insert a splitter between the two child elements of <code>#panels</code> using default
settings (vertical splitter and defaults as shown below).
</p>
<pre class="codesample"><span style="color: #770000"><script></span>
jQuery(<span style="color: #008800; font-weight: bold">function</span> ($) {
$(<span style="background-color: #fff0f0">'#panels'</span>).enhsplitter();
});
<span style="color: #770000"></script></span>
</pre>
</dd>
<dt>Advanced Usage</dt>
<dd>
<p>
<code>jquery.enhsplitter</code> has a number of options, available below. Usage is just like most
jQuery plugins - just pass the options as an object parameter.
</p>
<pre class="codesample"><span style="color: #770000"><script></span>
jQuery(<span style="color: #008800; font-weight: bold">function</span> ($) {
$(<span style="background-color: #fff0f0">'#panels'</span>).enhsplitter({handle<span
style="color: #333333">:</span> <span style="background-color: #fff0f0">'striped'</span>, position<span
style="color: #333333">:</span> <span
style="background-color: #fff0f0">'150px'</span>, minSize<span
style="color: #333333">:</span> <span style="color: #0000DD; font-weight: bold">0</span>});
<span style="color: #770000"></script></span>
</pre>
</dd>
</dl>
<h1>Options</h1>
<dl>
<dt>vertical</dt>
<dd>
<code>[true|false]</code>
<code class="default">Default: true</code>
<p>
Determines whether the splitter is vertical or horizontal.
</p>
</dd>
<dt>minSize, leftMinSize, rightMinSize, topMinSize, bottomMinSize</dt>
<dd>
<code>[number]</code>
<code class="default">Default: 100</code>
<p>
Defines the minimum sizes for each panel, in pixels.
</p>
<ul>
<li><code>minSize</code> is an alias to set both <code>leftMinSize</code> and <code>rightMinSize</code>.
</li>
<li><code>topMinSize</code> and <code>bottomMinSize</code> are internally an alias for
<code>leftMinSize</code> and <code>rightMinSize</code> respectively.
</li>
</ul>
</dd>
<dt>maxSize, leftMaxSize, rightMaxSize, topMaxSize, bottomMaxSize</dt>
<dd>
<code>[number]</code>
<code class="default">Default: 100</code>
<p>
Defines the maximum sizes for each panel, in pixels.
</p>
<ul>
<li><code>maxSize</code> is an alias to set both <code>leftMaxSize</code> and <code>rightMaxSize</code>.
</li>
<li><code>topMaxSize</code> and <code>bottomMaxSize</code> are internally an alias for
<code>leftMaxSize</code> and <code>rightMaxSize</code> respectively.
</li>
</ul>
</dd>
<dt>position</dt>
<dd>
<code>[number (px)|string (px|%)]</code>
<code class="default">Default: '50%'</code>
<p>
Sets the starting size for the left or top panel. Position can be defined in pixels by passing an
number <code>{position: 125}</code>, or a string with a 'px' suffix <code>{position: '125px'}</code>,
or as a percentage as a string with a '%' suffix. <code>{position: '25%'}</code>. Strings without a
suffix will be assumed to be in pixels.
</p>
</dd>
<dt>invisible</dt>
<dd>
<code>[true|false]</code>
<code class="default">Default: false</code>
<p>
Turns the splitter invisible. The splitter will still work, there will simply be no visible control.
This is similar to the splitter functionality in JetBrains IDEs.
</p>
</dd>
<dt>handle</dt>
<dd>
<code>['default'|'stripes'|'bar'|'block'|'dots'|'lotsofdots'|'none'|<user-defined>]</code>
<code class="default">Default: 'default'</code>
<p>
Defines how the the collapse is drawn.
</p>
<ul>
<li><code>'default'</code> is currently equivalent to 'stripes' but may change in the future.</li>
<li><code>'stripes'</code> draws a striped handle, as shown in the first two examples above.</li>
<li><code>'bar'</code> draws a narrow grey bar, as shown in the third example above.</li>
<li><code>'block'</code> draws a wide grey block that fills the width of the splitter.</li>
<li><code>'dots'</code> draws five small equidistant dots with no border.</li>
<li><code>'lotsofdots'</code> draws a series of small dots.</li>
<li><code>'none'</code> hides the handle completely, disabling it. This effect is also achieved
when setting <code>{invisible: true}</code>; it is not necessary to set both.
</li>
<li>
<code><user-defined></code> - Identifier for any CSS class you create. By adding new
<code>.splitter-handle-</code> classes (see the CSS file), you can create custom styles without
overriding the standard ones.
</li>
</ul>
</dd>
<dt>collapse</dt>
<dd>
<code>['left'|'right'|'up'|'down'|'none']</code>
<code class="default">Default: true</code>
<p>
Determines which direction the panel collapses when the handle is clicked.
Setting <code>{collapse: 'none'}</code> leaves the handle visible while disabling its
functionality, leaving the handle and hover/active effects in place for standard dragging.
</p>
</dd>
<dt>fixed</dt>
<dd>
<code>[true|false]</code>
<code class="default">Default: false</code>
<p>
Fixes the splitter in place by disabling dragging. This option does not affect the collapse handle.
</p>
<p>
This option is useful for creating fixed width navigation, tool, or other bars. When the options
<code>{position: 150, minSize: 0, fixed: true}</code> are used together, it creates a splitter
with a narrow panel (in this case 150px) that cannot be resized, but is completely hidden when the
collapse handle is clicked (and vice versa).
</p>
</dd>
<dt>height</dt>
<dd>
<code>[number (pixels)|css value]</code>
<code class="default">Default: <em>none</em></code>
<p>
Specifies the height of the container.
</p>
<p>
Any CSS value can be used; numbers with no suffix will be treated as pixel values.
</p>
<p>
In the instance that the both the container and parent heights have not been specified, the CSS on
the container will cause the height to become 0. If this happens, height will default to 10em.
</p>
</dd>
<dt>splitterSize</dt>
<dd>
<code>[number (pixels)|css value]</code>
<code class="default">Default: <em>none (defined by CSS)</em></code>
<p>
Specifies the size of the splitter bar, allowing some limited customization for individual splitters
without custom CSS. Ideal when paired with <code>{invisible: true}</code>, also useful for increasing
the splitter size on mobile sites (for easier use on touch devices).
</p>
<p>
Any CSS value can be used; numbers with no suffix will be treated as pixel values.
</p>
</dd>
<dt>onDragStart</dt>
<dd>
<code>function (event, splitter_container) { ... }</code>
<code class="default">Default: $.noop</code>
<p>Event handler called when a user starts dragging a splitter.</p>
<p>Parameters passed are the standard event handler data, and the .splitter_container object.</p>
</dd>
<dt>onDragEnd</dt>
<dd>
<code>function (event, splitter_container) { ... }</code>
<code class="default">Default: $.noop</code>
<p>Event handler called when a user stops dragging a splitter.</p>
<p>Parameters passed are the standard event handler data, and the .splitter_container object.</p>
</dd>
<dt>onDrag</dt>
<dd>
<code>function (event, splitter_container) { ... }</code>
<code class="default">Default: $.noop</code>
<p>Event handler called after a user moves a splitter.</p>
<p>Parameters passed are the standard event handler data, and the .splitter_container object.</p>
</dd>
</dl>
<h1>Commands</h1>
<p>
These commands can be used on splitters which have already been created.
They will have no effect on non-splitter objects. Attempting to use a command on a jQuery object which is not
a jquery.enhsplitter object will simply create an splitter with default options.
</p>
<dl>
<dt>move</dt>
<dd>
<code>.enhsplitter('move', [number (px)|string (px|%)])</code>
<p>
Changes the splitter position to the location specified (with range checks).
</p>
</dd>
<dt>refresh</dt>
<dd>
<code>.enhsplitter('refresh')</code>
<p>
Forces a refresh of the container size and splitter location (with range checks).
</p>
</dd>
<dt>reset</dt>
<dd>
<code>.enhsplitter('reset')</code>
<p>
Resets the splitter location to it's starting position.
</p>
</dd>
<dt>collapse</dt>
<dd>
<code>.enhsplitter('collapse')</code>
<p>
Collapses the splitter as if the collapse handle was clicked.
</p>
</dd>
<dt>uncollapse</dt>
<dd>
<code>.enhsplitter('uncollapse')</code>
<p>
Returns the splitter to it's pre-collapsed position.
</p>
</dd>
<dt>visible</dt>
<dd>
<code>.enhsplitter('visible', [true|false])</code>
<p>
Sets whether the splitter is visible or not. This is equivalent to (but opposite from) the
<code>invisible</code> option, visually hiding the splitter but leaving it usable.
</p>
</dd>
<dt>handle</dt>
<dd>
<code>.enhsplitter('handle', ['default'|'bar'|'block'|'none'|<user-defined>])</code>
<p>Equivalent to the <code>handle</code> option, changes the handle style on the fly.</p>
</dd>
<dt>destroy</dt>
<dd>
<code>.enhsplitter('destroy');</code>
<p>
Removes the splitter container, splitter panels, and splitter bar, returning the DOM to its previous layout.
</p>
</dd>
</dl>
</div>
</body>
</html>