1 | /***************************************************** |
---|
2 | * ypSlideOutMenu |
---|
3 | * 3/04/2001 |
---|
4 | * |
---|
5 | * a nice little script to create exclusive, slide-out |
---|
6 | * menus for ns4, ns6, mozilla, opera, ie4, ie5 on |
---|
7 | * mac and win32. I've got no linux or unix to test on but |
---|
8 | * it should(?) work... |
---|
9 | * |
---|
10 | * --youngpup-- |
---|
11 | *****************************************************/ |
---|
12 | |
---|
13 | //var isIE = false; |
---|
14 | //var isOther = false; |
---|
15 | //var isNS4 = false; |
---|
16 | //var isNS6 = false; |
---|
17 | // constructor |
---|
18 | |
---|
19 | var IEzindexworkaround=false; // set this true to enable the IE z-index bugfix |
---|
20 | |
---|
21 | function ypSlideOutMenu(id, dir, left, top, width, height,pos) |
---|
22 | { |
---|
23 | |
---|
24 | this.ie = document.all ? 1 : 0 |
---|
25 | this.ns4 = document.layers ? 1 : 0 |
---|
26 | this.dom = document.getElementById ? 1 : 0 |
---|
27 | |
---|
28 | if (this.ie || this.ns4 || this.dom) { |
---|
29 | this.id = id |
---|
30 | this.dir = dir |
---|
31 | this.orientation = dir == "left" || dir == "right" ? "h" : "v" |
---|
32 | this.dirType = dir == "right" || dir == "down" ? "-" : "+" |
---|
33 | this.dim = this.orientation == "h" ? width : height |
---|
34 | //this.hideTimer = false |
---|
35 | //this.aniTimer = false |
---|
36 | this.open = false |
---|
37 | this.over = false |
---|
38 | //this.startTime = 0 |
---|
39 | |
---|
40 | // global reference to this object |
---|
41 | //this.gRef = "ypSlideOutMenu_"+id |
---|
42 | //eval(this.gRef+"=this") |
---|
43 | |
---|
44 | // add this menu object to an internal list of all menus |
---|
45 | //ypSlideOutMenu.Registry[id] = this |
---|
46 | |
---|
47 | var d = document |
---|
48 | |
---|
49 | var strCSS = '<style type="text/css">'; |
---|
50 | strCSS += '#' + this.id + 'Container { visibility:hidden; ' |
---|
51 | if(pos) |
---|
52 | { |
---|
53 | strCSS += pos+':' + left + 'px; ' |
---|
54 | } |
---|
55 | else |
---|
56 | { |
---|
57 | strCSS += 'left:' + left + 'px; ' |
---|
58 | } |
---|
59 | strCSS += 'top:' + top + 'px; ' |
---|
60 | strCSS += 'overflow:visible; z-index:10000; }' |
---|
61 | strCSS += '#' + this.id + 'Container, #' + this.id + 'Content { position:absolute; ' |
---|
62 | strCSS += 'width:' + width + 'px; ' |
---|
63 | // strCSS += 'height:' + height + 'px; ' |
---|
64 | // strCSS += 'clip:rect(0 ' + width + ' ' + height + ' 0); ' |
---|
65 | strCSS += '}' |
---|
66 | strCSS += '</style>'; |
---|
67 | |
---|
68 | d.write(strCSS); |
---|
69 | // alert(strCSS); |
---|
70 | // this.load() |
---|
71 | |
---|
72 | } |
---|
73 | } |
---|
74 | |
---|
75 | ypSlideOutMenu.aLs = function(layerID) |
---|
76 | { |
---|
77 | |
---|
78 | this.isIE = false; |
---|
79 | this.isOther = false; |
---|
80 | this.isNS4 = false; |
---|
81 | this.isNS6 = false; |
---|
82 | if(document.getElementById) |
---|
83 | { |
---|
84 | if(!document.all) |
---|
85 | { |
---|
86 | this.isNS6=true; |
---|
87 | } |
---|
88 | if(document.all) |
---|
89 | { |
---|
90 | this.isIE=true; |
---|
91 | } |
---|
92 | } |
---|
93 | else |
---|
94 | { |
---|
95 | if(document.layers) |
---|
96 | { |
---|
97 | this.isNS4=true; |
---|
98 | } |
---|
99 | else |
---|
100 | { |
---|
101 | this.isOther=true; |
---|
102 | } |
---|
103 | } |
---|
104 | |
---|
105 | var returnLayer; |
---|
106 | if(this.isIE) |
---|
107 | { |
---|
108 | returnLayer = eval("document.all." + layerID + ".style"); |
---|
109 | } |
---|
110 | if(this.isNS6) |
---|
111 | { |
---|
112 | returnLayer = eval("document.getElementById('" + layerID + "').style"); |
---|
113 | } |
---|
114 | if(this.isNS4) |
---|
115 | { |
---|
116 | returnLayer = eval("document." + layerID); |
---|
117 | } |
---|
118 | if(this.isOther) |
---|
119 | { |
---|
120 | returnLayer = "null"; |
---|
121 | alert("Error:\nDue to your browser you will probably not\nbe able to view all of the following page\nas it was designed to be viewed. We regret\nthis error sincerely."); |
---|
122 | } |
---|
123 | return returnLayer; |
---|
124 | } |
---|
125 | // HideShow 1.0 Jim Cummins - http://www.conxiondesigns.com |
---|
126 | |
---|
127 | ypSlideOutMenu.ShowL = function(ID) |
---|
128 | { |
---|
129 | ypSlideOutMenu.aLs(ID).visibility = "visible"; |
---|
130 | } |
---|
131 | |
---|
132 | ypSlideOutMenu.HideL =function(ID) |
---|
133 | { |
---|
134 | ypSlideOutMenu.aLs(ID).visibility = "hidden"; |
---|
135 | } |
---|
136 | |
---|
137 | ypSlideOutMenu.HideShow = function(ID) |
---|
138 | { |
---|
139 | |
---|
140 | if((ypSlideOutMenu.aLs(ID).visibility == "visible") || (ypSlideOutMenu.aLs(ID).visibility == "")) |
---|
141 | { |
---|
142 | ypSlideOutMenu.aLs(ID).visibility = "hidden"; |
---|
143 | } |
---|
144 | else if(ypSlideOutMenu.aLs(ID).visibility == "hidden") |
---|
145 | { |
---|
146 | ypSlideOutMenu.aLs(ID).visibility = "visible"; |
---|
147 | } |
---|
148 | } |
---|
149 | |
---|
150 | |
---|
151 | ypSlideOutMenu.showMenu = function(id) |
---|
152 | { |
---|
153 | //temporarly hide all selectboxes to fix IE bug with z-index |
---|
154 | if(IEzindexworkaround && document.all) |
---|
155 | { |
---|
156 | for (var i=0; i<document.all.length; i++) { |
---|
157 | o = document.all(i) |
---|
158 | if (o.type == 'select-one' || o.type == 'select-multiple') { |
---|
159 | if (o.style) o.style.display = 'none';// todo: add check for select in div? |
---|
160 | } |
---|
161 | } |
---|
162 | } |
---|
163 | |
---|
164 | |
---|
165 | ypSlideOutMenu.ShowL(id+'Container'); |
---|
166 | |
---|
167 | } |
---|
168 | |
---|
169 | ypSlideOutMenu.hide = function(id) |
---|
170 | { |
---|
171 | ypSlideOutMenu.HideL(id+'Container'); |
---|
172 | //show all selectboxes again to fix IE bug with z-index |
---|
173 | if(document.all) |
---|
174 | { |
---|
175 | for (var i=0; i<document.all.length; i++) { |
---|
176 | o = document.all(i) |
---|
177 | if (o.type == 'select-one' || o.type == 'select-multiple') { |
---|
178 | // todo: add check for select in div? |
---|
179 | if (o.style) o.style.display = 'inline'; |
---|
180 | } |
---|
181 | } |
---|
182 | } |
---|
183 | |
---|
184 | } |
---|
185 | |
---|
186 | |
---|
187 | |
---|