GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — webSpecialEffect/collapse3.html at master · 93qlin/webSpecialEffect

Expand file tree

/

collapse3.html

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
202 lines (191 loc) · 6.12 KB
/

collapse3.html

Copy path

File metadata and controls

202 lines (191 loc) · 6.12 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>适合于后台使用的动画折叠菜单</title>
<script type="text/javascript">
function FOLDMenu(id, onlyone) {
if (!document.getElementById || !document.getElementsByTagName) { return false; }
this.menu = document.getElementById(id);
this.submenu = this.menu.getElementsByTagName("ul");
this.speed = 3;
this.time = 10;
this.onlyone = onlyone == true ? onlyone : false;
this.links = this.menu.getElementsByTagName("a");
}
FOLDMenu.prototype.init = function() {
var mainInstance = this;
for (var i = 0; i < this.submenu.length; i++) {
this.submenu[i].getElementsByTagName("span")[0].onclick = function() {
mainInstance.toogleMenu(this.parentNode);
};
}
for (var i = 0; i < this.links.length; i++) {
this.links[i].onclick = function() {
this.className = "current";
mainInstance.removeCurrent(this);
}
}
}
FOLDMenu.prototype.removeCurrent = function(link) {
for (var i = 0; i < this.links.length; i++) {
if (this.links[i] != link) {
this.links[i].className = " ";
}
}
}
FOLDMenu.prototype.toogleMenu = function(submenu) {
if (submenu.className == "open") {
this.closeMenu(submenu);
} else {
this.openMenu(submenu);
}
}
FOLDMenu.prototype.openMenu = function(submenu) {
var fullHeight = submenu.getElementsByTagName("span")[0].offsetHeight;
var links = submenu.getElementsByTagName("a");
for (var i = 0; i < links.length; i++) {
fullHeight += links[i].offsetHeight;
}
var moveBy = Math.round(this.speed * links.length);
var mainInstance = this;
var intId = setInterval(function() {
var curHeight = submenu.offsetHeight;
var newHeight = curHeight + moveBy;
if (newHeight < fullHeight) {
submenu.style.height = newHeight + "px";
} else {
clearInterval(intId);
submenu.style.height = "";
submenu.className = "open";
}
}, this.time);
this.collapseOthers(submenu);
}
FOLDMenu.prototype.closeMenu = function(submenu) {
var minHeight = submenu.getElementsByTagName("span")[0].offsetHeight;
var moveBy = Math.round(this.speed * submenu.getElementsByTagName("a").length);
var mainInstance = this;
var intId = setInterval(function() {
var curHeight = submenu.offsetHeight;
var newHeight = curHeight - moveBy;
if (newHeight > minHeight) {
submenu.style.height = newHeight + "px";
} else {
clearInterval(intId);
submenu.style.height = "";
submenu.className = "";
}
}, this.time);
}
FOLDMenu.prototype.collapseOthers = function(submenu) {
if (this.onlyone) {
for (var i = 0; i < this.submenu.length; i++) {
if (this.submenu[i] != submenu) {
this.closeMenu(this.submenu[i]);
}
}
}
}
</script>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
.foldmenu {
border: 1px solid #000;
width: 150px;
margin: 50px;
}
.foldmenu ul {
list-style-type: none;
height: 25px;
line-height: 25px;
overflow: hidden;
cursor: pointer;
}
.foldmenu ul.open {
height: auto;
}
.foldmenu ul span {
display: block;
padding-left: 5px
}
.foldmenu ul li {
border-bottom: 1px solid #DDDDDD;
}
.foldmenu li a {
background-color: #EEEEEE;
color: #006666;
display: block;
padding: 5px 10px;
text-decoration: none;
text-align: center;
}
.foldmenu li a:hover {
background-color: #006666;
color: #ffffff;
}
.foldmenu li a.current {
background-color: #006666;
color: #ffffff;
}
</style>
</head>
<body>
<div id="foldmenu" class="foldmenu" style="float:left;">
<ul class="open">
<span>编程天地</span>
<li><a href="#">电子书籍</a></li>
<li><a href="#">源码乐园</a></li>
</ul>
<ul>
<span>中国门户</span>
<li><a href="#">百度搜索</a></li>
<li><a href="#">新浪新闻</a></li>
<li><a href="#">腾讯QQ</a></li>
</ul>
<ul>
<span>音乐网站</span>
<li><a href="#">百度音乐</a></li>
<li><a href="#">QQ163</a></li>
</ul>
</div>
<div id="foldmenu2" class="foldmenu" style="float:right;">
<ul class="open">
<span>世界大学</span>
<li><a href="#">剑桥</a></li>
<li><a href="#">牛津</a></li>
<li><a href="#">哈佛</a></li>
<li><a href="#">麻省理工</a></li>
</ul>
<ul>
<span>中国大学</span>
<li><a href="#">北大</a></li>
<li><a href="#">清华</a></li>
<li><a href="#">港大</a></li>
</ul>
<ul>
<span>世界好车</span>
<li><a href="#">宝马</a></li>
<li><a href="#">奔驰</a></li>
<li><a href="#">奥迪</a></li>
</ul>
<ul>
<span>开源论坛</span>
<li><a href="#">PhpWind</a></li>
<li><a href="#">Discuz!</a></li>
</ul>
</div>
<script type="text/javascript">
window.onload = function() {
myMenu = new FOLDMenu("foldmenu", true);
myMenu.init();
myMenu2 = new FOLDMenu("foldmenu2");
myMenu2.init();
};
</script>
</body>
</html>
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.