forked from DerOperator/PositionIsEverything
-
Notifications
You must be signed in to change notification settings - Fork 0
/
css-flyout.html
executable file
·703 lines (519 loc) · 19.5 KB
/
css-flyout.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
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>A demonstration of Pure CSS Flyouts in action</title>
<meta http-equiv="content-Type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="Make a pure CSS flyout nav." />
<meta name="distribution" content="global" />
<meta name="resource-type" content="document" />
<meta http-equiv="Content-Language" content="en-us" />
<meta name="robots" content="all" />
<meta name="mssmarttagspreventparsing" content="true" />
<meta http-equiv="imagetoolbar" content="no" />
<meta http-equiv="MSThemeCompatible" content="no" />
<meta name="Rating" content="General" />
<meta name="revisit-after" content="30 Days" />
<meta name="doc-class" content="Living Document" />
<link rel="SHORTCUT ICON" href="favicon.ico" type="image/x-icon" />
<script type="text/javascript">if (window.self != window.top) window.top.location = window.self.location; </script>
<script type="text/javascript"><!--//--><![CDATA[//><!--
sfFocus = function() {
var sfEls = document.getElementsByTagName("A");
for (var i=0; i<sfEls.length; i++) {
sfEls[i].onfocus=function() {
this.className+=" sffocus";
}
sfEls[i].onblur=function() {
this.className=this.className.replace(new RegExp(" sffocus\\b"), "");
}
}
}
if (window.attachEvent) window.attachEvent("onload", sfFocus);
//--><!]]></script>
<!-- The above script came from "Son of Suckerfish", and enhances tabbing on the expanded nav when that occurs. -->
<script type="text/javascript" src="sidepages/auto-enableAddClassOnKey.js"></script>
<script type="text/javascript"><!--//--><![CDATA[//><!--
// window.document.onkeypress = bv_addClassKeyListener;
//--><!]]></script>
<style type="text/css">
html, body, ul, li {margin: 0; padding: 0; border: 0;}
body {
color: #000;
margin: 30px;
background: #eee;
font-size: 100.01%;
font-family: verdana, sans-serif;
}
.alignright {margin: 0 30px 30px 0; text-align: right;}
.small {font-size: .8em;}
.back {text-align: right; padding: 3px 10px 0 0;}
.back a {text-align: right; font-size: .8em; color: #000;}
.textbox {
border: 1px solid #252;
margin: 20px 10%;
padding: 0 10px;
background: #fff8f8;
}
img {border: 0;}
h1 {text-align: center; font-family: tahoma, arial, sans-serif; color: #484;}
h1:active {background: red;}
h2 {font-size: 1em; font-family: verdana, sans-serif; margin: 10px;}
p {color: #000; font-size: .9em;}
ul { /* needs the Holly hack to avoid IE bugs */
border-top: 1px solid #000;
}
li {
list-style: none; /* kills the list item "bullet" markers */
border-bottom: 1px solid #000; /* Makes side borders on flyouts */
position: relative;
text-align: center;
vertical-align: bottom; /* for IE5/win */
font-weight: bold;
font-family: arial, sans-serif;
}
.nav a {
display: block;
vertical-align: bottom; /* needed for IE5/win */
color: #552;
text-decoration: none;
padding: 5px 10px;
border: 1px solid #000;
border-width: 0 1px; /* Makes side borders on flyouts */
}
.nav a:hover {color: #c44; text-decoration: underline;}
.nav a:focus, .nav a.sffocus { /* enhances the focus styling for keyboard tabbing */
background-color: #00c !important;
color: white;
}
.float-holder-left {
width: 150px;
float: left;
margin: 40px 20px 0 0;
}
.float-holder-right {
width: 150px;
float: right;
margin: 40px 0 0 20px;
}
.nav div {
width: 150px;
position: absolute;
left: -3000px;
}
/* \*/
.nav div {
width: 220px;
wid\th: 150px;
}
/* Box model fix for IE5.x Win */
.float-holder-left div {
padding: 30px 60px 30px 10px;
}
.float-holder-right div {
padding: 30px 10px 30px 60px;
}
.float-holder-left div.leftbox,
.float-holder-right div.leftbox {
padding: 30px 10px 30px 60px;
}
.float-holder-left div.rightbox,
.float-holder-right div.rightbox {
padding: 30px 60px 30px 10px;
}
.float-holder-left .nav div.zone,
.float-holder-right .nav div.zone {
padding: 0;
width: 150px;
height: 10px;
left: -3000px;
top: auto;
bottom: -10px;
font-size: 1px;
}
.float-holder-left .nav li:hover div.zone,
.float-holder-right .nav li:hover div.zone {
left: 0;
}
.float-holder-left li:hover div div,
.float-holder-left div li:hover div div,
.float-holder-right li:hover div div,
.float-holder-right div li:hover div div {
left: -3000px;
}
.float-holder-left li:hover div,
.float-holder-left div li:hover div,
.float-holder-left div div li:hover div.rightbox,
.float-holder-right div div li:hover div.rightbox {
left: 126px;
top: -28px;
}
.float-holder-left div div li:hover div.leftbox,
.float-holder-right li:hover div,
.float-holder-right div li:hover div,
.float-holder-right div div li:hover div.leftbox {
left: auto;
right: 126px;
top: -28px;
}
.main {z-index: 5; background: #ecc;}
.main li {background-color: #dbb;}
.sales {z-index: 4; background: #fcd}
.sales li {background-color: #ebc;}
.products {z-index: 3; background: #ddf;}
.products li {background-color: #bbd;}
.products li li {background-color: #99b;}
.products li li li {background-color: #fff;}
.advertising {z-index: 2; background: #dfd;}
.advertising li {background-color: #bdb;}
.nav ul a {color: #fff;}
.nav li li li li a {
color: #000;
}
.float-holder-left .arrow {
background: url(images/arrow-right.gif) no-repeat 100% 50%;
}
.float-holder-right .arrow {
background: url(images/arrow-left.gif) no-repeat 0 50%;
}
.arrow-double {
background: url(images/arrow-double.gif) no-repeat 0 50%;
}
.in-arrow-right {
background: url(images/arrow-right-lite.gif) 0 .4em no-repeat;
}
.in-arrow-left {
background: url(images/arrow-left-lite.gif) 100% .4em no-repeat;
}
/* \*/ /*/
.nav div, .nav ul ul .leftbox, .nav ul ul .rightbox {
position: relative;
left: 5px;
padding: 0;
}
.nav .arrow, .nav .arrow-double {border-bottom: 1px solid #000;}
.zone {display: none;}
/* */
.classW {font-size: .6em !important;}
.classW div, .classW ul ul .leftbox, .classW ul ul .rightbox,
.classW li:hover div, .classW ul li:hover div .leftbox, .classW ul ul .rightbox {
position: relative !important;
left: 5px !important;
top: 0 !important;
padding: 0 !important;
}
.classW .arrow, .classW .arrow-double, .classW .in-arrow-right, .classW .in-arrow-left {
border-bottom: 1px solid #000;
background-image: none !important;
}
.classW .zone {display: none;}
</style>
<!--[if IE]>
<style type="text/css">
body {behavior: url(sidepages/csshover.htc);}
.nav a, ul {height: 1%;}
li {
height: 1%;
margin-left: -16px;
mar\gin-left: 0;
}
</style>
<noscript>
<style type="text/css">
.nav div, .nav ul ul .leftbox, .nav ul ul .rightbox {
position: relative;
left: 5px;
padding: 0;
}
.nav .arrow, .nav .arrow-double {border-bottom: 1px solid #000;}
.zone {display: none;}
</style>
</noscript>
<![endif]-->
<!-- The above block calls the special .htc script that forces compliance in IE/win. -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/scripts/init.js"></script>
</head>
<body>
<div class="float-holder-left">
<ul class="nav bvAssignKey-w-classW">
<li class="main"><a class="arrow" href="#">Main Pages</a>
<div class="zone"></div>
<div>
<ul>
<li class="in-arrow-right"><a href="#">Table Of Contents</a></li>
<li><a href="#">Site Map</a></li>
<li><a href="#">Guestbook</a></li>
</ul>
</div>
</li>
<li class="sales"><a class="arrow" href="#">Sales Pages</a>
<div class="zone"></div>
<div>
<ul>
<li class="in-arrow-right"><a href="#">Inventory</a></li>
<li><a href="#">Orders</a></li>
<li><a href="#">Back Orders</a></li>
<li><a href="#">Delivery Schedules</a></li>
</ul>
</div>
</li>
<li class="products"><a class="arrow" href="#">Products</a>
<div class="zone"></div>
<div>
<ul>
<li class="in-arrow-right" style="z-index: 4;"><a href="#">Full Listing</a></li>
<li style="z-index: 3;"><a class="arrow" href="#">Departments</a>
<div class="zone"></div>
<div>
<ul>
<li class="in-arrow-right"><a href="#">Hardware</a></li>
<li><a href="#">Software</a></li>
<li><a href="#">Replacement parts</a></li>
</ul>
</div>
</li>
<li style="z-index: 2;"><a href="#">Support</a></li>
<li style="z-index: 1;"><a class="arrow" href="#">Legal</a>
<div class="zone"></div>
<div>
<ul>
<li class="in-arrow-right"><a href="#">Disclaimers</a></li>
<li><a href="#">Privacy Policy</a></li>
<li><a class="arrow-double" href="#">Inquiries</a>
<div class="zone"></div>
<div class="leftbox">
<ul>
<li class="in-arrow-left"><a href="#">Company Policies</a>
<li><a href="#">Related Documents</a>
</ul>
</div>
<div class="rightbox">
<ul>
<li class="in-arrow-right"><a href="#">Arbitration</a>
<li><a href="#">Case Histories</a>
</ul>
</div>
</li>
</ul>
</div>
</li>
</ul>
</div>
</li>
<li class="advertising"><a class="arrow" href="#">Advertising</a>
<div class="zone"></div>
<div>
<ul>
<li class="in-arrow-right"><a href="#">Endorsements</a></li>
<li><a href="#">Print</a></li>
<li><a href="#">Audio</a></li>
<li><a href="#">Video</a></li>
</ul>
</div>
</li></ul>
<!-- The above two tags cannot have any white space between them,
or some browsers may show spurious code "ghosts" on the screen -->
</div><!-- end .float-holder-left -->
<div class="float-holder-right">
<ul class="nav bvAssignKey-w-classW">
<li class="main"><a class="arrow" href="#">Main Pages</a>
<div class="zone"></div>
<div>
<ul>
<li class="in-arrow-left"><a href="#">Table Of Contents</a></li>
<li><a href="#">Site Map</a></li>
<li><a href="#">Guestbook</a></li>
</ul>
</div>
</li>
<li class="sales"><a class="arrow" href="#">Sales Pages</a>
<div class="zone"></div>
<div>
<ul>
<li class="in-arrow-left"><a href="#">Inventory</a></li>
<li><a href="#">Orders</a></li>
<li><a href="#">Back Orders</a></li>
<li><a href="#">Delivery Schedules</a></li>
</ul>
</div>
</li>
<li class="products"><a class="arrow" href="#">Products</a>
<div class="zone"></div>
<div>
<ul>
<li class="in-arrow-left" style="z-index: 4;"><a href="#">Full Listing</a></li>
<li style="z-index: 3;"><a class="arrow" href="#">Departments</a>
<div class="zone"></div>
<div>
<ul>
<li class="in-arrow-left"><a href="#">Hardware</a></li>
<li><a href="#">Software</a></li>
<li><a href="#">Replacement parts</a></li>
</ul>
</div>
</li>
<li style="z-index: 2;"><a href="#">Support</a></li>
<li style="z-index: 1;"><a class="arrow" href="#">Legal</a>
<div class="zone"></div>
<div>
<ul>
<li class="in-arrow-left"><a href="#">Disclaimers</a></li>
<li><a href="#">Privacy Policy</a></li>
<li><a class="arrow-double" href="#">Inquiries</a>
<div class="zone"></div>
<div class="leftbox">
<ul>
<li class="in-arrow-left"><a href="#">Company Policies</a>
<li><a href="#">Related Documents</a>
</ul>
</div>
<div class="rightbox">
<ul>
<li class="in-arrow-right"><a href="#">Arbitration</a>
<li><a href="#">Case Histories</a>
</ul>
</div>
</li>
</ul>
</div>
</li>
</ul>
</div>
</li>
<li class="advertising"><a class="arrow" href="#">Advertising</a>
<div class="zone"></div>
<div>
<ul>
<li class="in-arrow-left"><a href="#">Endorsements</a></li>
<li><a href="#">Print</a></li>
<li><a href="#">Audio</a></li>
<li><a href="#">Video</a></li>
</ul>
</div>
</li></ul>
<!-- The above two tags cannot have any white space between them,
or some browsers may show spurious code "ghosts" on the screen -->
</div><!-- end .float-holder-right -->
<h1>All-CSS Flyout Nav</h1>
<p style="margin-bottom: 0; text-align: center;">
<!-- If this bottom margin is present, IE repeats it under the cleared nav floats. -->
These two navs have identical HTML, other than classes for the brown arrows, and they
are driven entirely via CSS rules.
Scripting is not required, other than to make IE/win obey <strong>:hover</strong>
when applied to non-links. The navs are floated opposite, sometimes touching the
clearing element below.
</p>
<div style="clear: both; background: #484; text-align: center; color: #fff;">Cleared element</div>
<div class="textbox">
<div class="back">
<a href="index-2.html"><strong>Return to PIE</strong></a>
</div>
<p>
The elements above are floated and cleared in a way designed to expose any IE float bugs
that could occur, but they are all suppressed in this method. However, if the nav is at the
bottom of the screen content, IE6 does not enjoy having the flyouts go below the bottom
of the body element and will let the flyouts vanish when those low flyouts are hovered below
the flowed content. A large bottom padding on the body element would satisfy IE
in that rare case.
</p>
<p>
IE/Mac does not support this method, but it has been hack-fed a set of dumbed down
rules to make the nav fully expand for accessibility. Additionally, there is a
<strong><noscript></strong> block that holds similar code for IE/Win when Javascript
is disabled, and the <noscript> block is inside a Conditional Comment, along
with the MS proprietary Jscript behavior call that makes it all work.
</p>
<p>
The <a href="sidepages/csshover.htc">Jscript</a> is the work of
<a href="http://www.xs4all.nl/~peterned/csshover.html"><strong>Peter Nederlof</strong></a>,
and fine work it is, too. This script not only makes IE support all hovering, but
all <strong>:active</strong> events as well. Try clicking on the H1 element in IE/win
for a shocker!
</p>
<div style="background: #e4e4e9; border: 1px solid #666; padding: 0 10px 10px; margin: 15px 10px;">
<h2>Suckerfish Alternative</h2>
<p>
A simpler script method for handling IE6 does exist, the
<a href="http://htmldog.com/articles/suckerfish/hover/">Suckerfish script</a>.
Basically the script watches the links to be hovered,
and when the mouseover event is triggered on a link it gets a class name applied, but
<em>only</em> during the mouseover event. Then you write duplicate selectors for the
hover rules, but referencing the JS-applied class name. The resulting IE6 faux-hovering
is effective and doesn't need a specical served mime type (simple JS file), but at the cost
of having to modify the CSS hover rules just a bit.
</p>
<p>
In this page we've added a small JS file from
<a href="http://www.htmldog.com/articles/suckerfish/focus/">Son of Suckerfish</a>
to enhance keyboard focussing.
</p>
<h2>Important point about the .htc file</h2>
<p>
When <strong>Service Pack 2</strong> is installed on Windows, the proprietary
<a href="sidepages/csshover.htc">.htc file</a>
will only work in IE6 when correctly served with the mime type
<strong>text/x-component</strong>. Mime types are defined by the server
administrator, so if your server is incorrectly set, IE6 will fail to
show the popups. That's just the way it is, folks. Hmmm, that Suckerfish is
looking better and better...
</p>
</div>
<p>
<strong>Update (Feb 26, 2005):</strong> It now appears that setting IE6's image
cache away from "Automatically"
is the cause of both the arrow calls (known effect) and also the border bleed-thru
effect. It appears that the BG images themselves have something to do with the border
bug, so avoiding the arrows or rearranging the CSS might prevent this border bug.
However, very few users ever mess with the cache settings, and a server-side fix
exists <a href="http://dean.edwards.name/my/flicker.html">here</a>.
</p>
<p>
<strong>Update (Feb 27, 2005):</strong> The method has been enhanced by the addition
of divs into the
nested list structure. The divs provide <strong>hoverable padding areas</strong>
around the flyouts,
which are more forgiving of shaky-handed users who may stray off the flyouts. The
flyout functioning is exactly the same, and the divs are semantically null so they
do not alter the list structure for screen readers and search engines.
</p>
<p>
Structural classes have been eliminated, but reverse z-indexing is required and
cannot be applied via the stylesheet without the use of sibling selectors, which
IE/Win does not support. However, if the arrows are omitted and a database can
apply descending z-index styling to the list items as they are outputted, then
a dynamically generated navigation could be achieved with this method.
</p>
<p>
Currently the demo is set to a pixel width, but we plan to try it out with an
EM width and are very confident it will work just as well that way. At least we hope so...
</p>
<p>
<strong>Update (April 6, 2005):</strong>This method has been demoed as a combo dropdown
and flyout "flat" menu. Go to the
<a href="css-dropdowns.html"><strong>Deluxe CSS Dropdowns and Flyouts</strong></a>
page, to get a load of what CSS can <em>really</em> do.
</p>
<br />
<p class="small alignright">
<a href="design/index.html"
title=" Big John's Advanced CSS Design "><strong>Big John Design</strong></a>
<a href="https://github.com/DerOperator/PositionIsEverything/issues">Contact Us</a>
©positioniseverything.net<br />
Last updated: July 2, 2008<br />
Created February 25, 2005
</p>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-39235363-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>