分享一款js实现菜单折叠显示效果,这个折叠菜单的兼容性很好,点击前面的折叠按钮来展开和收缩菜单列表。
<!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=gb2312" /> <meta name="keywords" content="武鸣人网站,武鸣信息网,武鸣本地网,武鸣信息资源平台,减肥,健身,励志,励志语录,js特效,网页特效,www.wuming.ren"> <meta name="description" content="欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。"> <title>兼容性非常好的js折叠菜单特效分享_武鸣人</title> <style> body{font-size:12px;text-align:left;font-family:Verdana,宋体,微软雅黑, Arial;background:#fff;color:#000;margin:0;padding:0;}ul,li{list-style:none;margin:0;padding:0;}.ibox{text-align:left;width:140px;padding-bottom:10px;margin:50px 50px 50px 50px;} .wuming{ position:relative; font-size:12px; color:#333333; background:#f7f7f7; height:20px; line-height:20px; padding-top:3px; padding-left:18px; border-top:1px #ffffff solid; border-bottom:1px #efefef solid; cursor:pointer; } .wuming span {position:absolute;left:0;top:4px;} .wuming a { color:#333; font-size:13px; } .wuming_ren li { line-height:22px; height:22px; padding-left:16px; } .wuming_ren li a { display:block; border-bottom:1px #dedede solid; } .wuming_ren li a:hover { background:#ff9900; color:#fff; } .SubMenuLayer { display:inline; cursor:hand; } .SubMenuLayerHidden { display:none; cursor:hand; } </style> </head> <body> <a href="https://www.wuming.ren">武鸣人</a>,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码。网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)<hr> <!--欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。--> <script type="text/javascript" src="https://www.wuming.ren/ad/tc.js"></script> <script type="text/javascript" src="https://www.wuming.ren/ad/a.js"></script> <div class="ibox" style="width:180px;"> <script LANGUAGE="javascript"> var subMenu = new Array(1); subMenu[0] = 'undefine'; function gotoURL(szURL){ window.open(szURL,'Main','') ; } </script> <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"> <tr valign="top"> <td id="Menu" style="display:inline;" width="100%"><script language="javascript">subMenu[0] = 1;</script> <div id="i1" class="wuming"><span id="ArrowSubLayer1Down" style="display:inline ; "><img onClick="javascript:www_wuming_ren_menu(1)" src="/img/20240411_www_wuming_ren_1.png" border="0"></span><span id="ArrowSubLayer1Right" style="display:none ; "><img onClick="javascript:www_wuming_ren_menu(1)" src="/img/20240411_www_wuming_ren_2.png" border="0"></span><a href="#"><strong>武鸣人一号菜单</strong></a></div> <div id="wuming_ren_menu1"> <ul class="wuming_ren"> <ul> <li><a href="https://www.wuming.ren" target="_blank" title="武鸣人">武鸣人一号列表</a></li> <li><a href="https://www.wuming.ren" target="_blank" title="武鸣人">武鸣人二号列表</a></li> <li><a href="https://www.wuming.ren" target="_blank" title="武鸣人">武鸣人三号列表</a></li> <li><a href="https://www.wuming.ren" target="_blank" title="武鸣人">武鸣人四号列表</a></li> </ul> </ul> </div> <script language="javascript">subMenu[0] = 2;</script> <div id="i2" class="wuming"><span id="ArrowSubLayer2Down" style="display:inline ; "><img onClick="javascript:www_wuming_ren_menu(2)" src="/img/20240411_www_wuming_ren_1.png" border="0"></span><span id="ArrowSubLayer2Right" style="display:none ; "><img onClick="javascript:www_wuming_ren_menu(2)" src="/img/20240411_www_wuming_ren_2.png" border="0"></span><a href="#"><strong>武鸣人二号菜单</strong></a></div> <div id="wuming_ren_menu2"> <ul class="wuming_ren"> <ul> <li><a href="https://www.wuming.ren" target="_blank" title="武鸣人">武鸣人一号列表</a></li> <li><a href="https://www.wuming.ren" target="_blank" title="武鸣人">武鸣人二号列表</a></li> <li><a href="https://www.wuming.ren" target="_blank" title="武鸣人">武鸣人三号列表</a></li> <li><a href="https://www.wuming.ren" target="_blank" title="武鸣人">武鸣人四号列表</a></li> </ul> </ul> </div> <script language="javascript">subMenu[0] = 3;</script> <div id="i3" class="wuming"><span id="ArrowSubLayer3Down" style="display:inline ; "><img onClick="javascript:www_wuming_ren_menu(3)" src="/img/20240411_www_wuming_ren_1.png" border="0"></span><span id="ArrowSubLayer3Right" style="display:none ; "><img onClick="javascript:www_wuming_ren_menu(3)" src="/img/20240411_www_wuming_ren_2.png" border="0"></span><a href="#"><strong>武鸣人三号菜单</strong></a></div> <div id="wuming_ren_menu3"> <ul class="wuming_ren"> <ul> <li><a href="https://www.wuming.ren" target="_blank" title="武鸣人">武鸣人一号列表</a></li> <li><a href="https://www.wuming.ren" target="_blank" title="武鸣人">武鸣人二号列表</a></li> <li><a href="https://www.wuming.ren" target="_blank" title="武鸣人">武鸣人三号列表</a></li> <li><a href="https://www.wuming.ren" target="_blank" title="武鸣人">武鸣人四号列表</a></li> </ul> </ul> </div> <script language="javascript">subMenu[0] = 4;</script> <div id="i4" class="wuming"><span id="ArrowSubLayer4Down" style="display:inline ; "><img onClick="javascript:www_wuming_ren_menu(4)" src="/img/20240411_www_wuming_ren_1.png" border="0"></span><span id="ArrowSubLayer4Right" style="display:none ; "><img onClick="javascript:www_wuming_ren_menu(4)" src="/img/20240411_www_wuming_ren_2.png" border="0"></span><a href="#"><strong>武鸣人四号菜单</strong></a></div> <div id="wuming_ren_menu4"> <ul class="wuming_ren"> <ul> <li><a href="https://www.wuming.ren" target="_blank" title="武鸣人">武鸣人一号列表</a></li> <li><a href="https://www.wuming.ren" target="_blank" title="武鸣人">武鸣人二号列表</a></li> <li><a href="https://www.wuming.ren" target="_blank" title="武鸣人">武鸣人三号列表</a></li> <li><a href="https://www.wuming.ren" target="_blank" title="武鸣人">武鸣人四号列表</a></li> </ul> </ul> </div> <script LANGUAGE="javascript"> var RightMenuUID = ""; function spreadMenu(n){ var szSubMenuClassName = document.getElementById('SubMenu'+n).className ; document.getElementById('SubMenu'+n).className = 'SubMenuLayerHidden' ; document.getElementById('ArrowLayer'+n+'Down').style.display = 'none' ; document.getElementById('ArrowLayer'+n+'Right').style.display = '' ; if (szSubMenuClassName == 'SubMenuLayerHidden'){ document.getElementById('wuming_ren_menu'+k).className = 'SubMenuLayer' ; document.getElementById('ArrowSubLayer'+k+'Down').style.display = '' ; document.getElementById('ArrowSubLayer'+k+'Right').style.display = 'none' ; }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) else{ document.getElementById('wuming_ren_menu'+k).className = 'SubMenuLayerHidden' ; document.getElementById('ArrowSubLayer'+k+'Down').style.display = 'none' ; document.getElementById('ArrowSubLayer'+k+'Right').style.display = '' ; }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) if (SubMenu1.scrollHeight > 440 && screen.availHeight <= 600){ SubMenu1.style.height = 440; SubMenu1.style.overflowY = 'scroll'; }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) } function www_wuming_ren_menu(k){ var szSubMenuClassName = document.getElementById('wuming_ren_menu'+k).className ; document.getElementById('wuming_ren_menu'+k).className = 'SubMenuLayerHidden' ; document.getElementById('ArrowSubLayer'+k+'Down').style.display = 'none' ; document.getElementById('ArrowSubLayer'+k+'Right').style.display = '' ; if (szSubMenuClassName == 'SubMenuLayerHidden'){ document.getElementById('wuming_ren_menu'+k).className = 'SubMenuLayer' ; document.getElementById('ArrowSubLayer'+k+'Down').style.display = '' ; document.getElementById('ArrowSubLayer'+k+'Right').style.display = 'none' ; }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) else{ document.getElementById('wuming_ren_menu'+k).className = 'SubMenuLayerHidden' ; document.getElementById('ArrowSubLayer'+k+'Down').style.display = 'none' ; document.getElementById('ArrowSubLayer'+k+'Right').style.display = '' ; }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) if (wuming_ren_menu1.scrollHeight > 440 && screen.availHeight <= 600){ wuming_ren_menu1.style.height = 440; wuming_ren_menu1.style.overflowY = 'scroll'; } }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) function showall() { www_wuming_ren_menu(1); www_wuming_ren_menu(2); www_wuming_ren_menu(3); www_wuming_ren_menu(4); www_wuming_ren_menu(5); www_wuming_ren_menu(6); }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) </script> </td> </tr> </table> </div> </body> </html>
本文来自武鸣人网站,转载请注明出处