这是一款js折叠导航菜单特效,可支持无限折叠,每个菜单项都带有收缩和展开按钮,实用的折叠菜单特效。
<!DOCTYPE html> <html> <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,ul,h3 {margin:0px; padding:0px;} li {list-style-type:none;} body{ font-size:12px; color:#333; font-family: Simsun; line-height:15px; } a{text-decoration:none;color:#004285;border:none;} a:hover{text-decoration:none;color:#C33;} #menu_wuming_ren { width:260px; margin:50px auto; padding:10px; border:#EEE 1px solid; } #menu_wuming_ren h3 { font-size:12px; } #menu_wuming_ren ul { background:url("/img/20240412_www_wuming_ren_1.gif") repeat-y 5px 0px; overflow:hidden; } #menu_wuming_ren ul li { padding:5px 0 2px 15px; background:url("/img/20240412_www_wuming_ren_2.gif") no-repeat 5px -32px; } #menu_wuming_ren ul li ul {display:none;} #menu_wuming_ren ul li em { cursor:pointer; display:inline-block; width:15px; float:left; height:15px; margin-left:-14px; background:url("/img/20240412_www_wuming_ren_2.gif") no-repeat -32px 2px; } #menu_wuming_ren ul li em.off { background-position: -17px -18px; } #menu_wuming_ren ul li#end_wuming_ren { background-color:#FFF; } #menu_wuming_ren ul.off { display:block; } --> </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 id="menu_wuming_ren"> <h3>js无限级折叠菜单 wuming.ren</h3> <ul> <li><em></em><a href='javascript:void(0);'>武鸣人_1_1</a> <ul> <li><em></em><a href='javascript:void(0);'>菜单_2_1</a> <ul> <li><em></em><a href='javascript:void(0);'>菜单_3_1</a> <ul> <li><em></em><a href='javascript:void(0);'>菜单_4_1</a> <ul> <li><a href='javascript:void(0);'>菜单_5_1</a></li> <li id='end_wuming_ren'><a href='javascript:void(0);'>菜单_5_2</a></li> </ul> </li> <li id='end_wuming_ren'><em></em><a href='javascript:void(0);'>菜单_4_2</a> <ul> <li><a href='javascript:void(0);'>菜单_5_1</a></li> <li id='end_wuming_ren'><a href='javascript:void(0);'>菜单_5_2</a></li> </ul> </li> </ul> </li> <li id='end_wuming_ren'><em></em><a href='javascript:void(0);'>菜单_3_2</a> <ul> <li><em></em><a href='javascript:void(0);'>菜单_4_1</a> <ul> <li><a href='javascript:void(0);'>菜单_5_1</a></li> <li id='end_wuming_ren'><a href='javascript:void(0);'>菜单_5_2</a></li> </ul> </li> <li id='end_wuming_ren'><em></em><a href='javascript:void(0);'>菜单_4_2</a> <ul> <li><a href='javascript:void(0);'>菜单_5_1</a></li> <li id='end_wuming_ren'><a href='javascript:void(0);'>菜单_5_2</a></li> </ul> </li> </ul> </li> </ul> </li> <li id='end_wuming_ren'><em></em><a href='javascript:void(0);'>菜单_2_2</a> <ul> <li><em></em><a href='javascript:void(0);'>菜单_3_1</a> <ul> <li><em></em><a href='javascript:void(0);'>菜单_4_1</a> <ul> <li><a href='javascript:void(0);'>菜单_5_1</a></li> <li id='end_wuming_ren'><a href='javascript:void(0);'>菜单_5_2</a></li> </ul> </li> <li id='end_wuming_ren'><em></em><a href='javascript:void(0);'>菜单_4_2</a> <ul> <li><a href='javascript:void(0);'>菜单_5_1</a></li> <li id='end_wuming_ren'><a href='javascript:void(0);'>菜单_5_2</a></li> </ul> </li> </ul> </li> <li id='end_wuming_ren'><em></em><a href='javascript:void(0);'>菜单_3_2</a> <ul> <li><em></em><a href='javascript:void(0);'>菜单_4_1</a> <ul> <li><a href='javascript:void(0);'>菜单_5_1</a></li> <li id='end_wuming_ren'><a href='javascript:void(0);'>菜单_5_2</a></li> </ul> </li> <li id='end_wuming_ren'><em></em><a href='javascript:void(0);'>菜单_4_2</a> <ul> <li><a href='javascript:void(0);'>菜单_5_1</a></li> <li id='end_wuming_ren'><a href='javascript:void(0);'>菜单_5_2</a></li> </ul> </li> </ul> </li> </ul> </li> </ul> </li> <li id='end_wuming_ren'><em></em><a href='javascript:void(0);'>武鸣人_1_2</a> <ul> <li><em></em><a href='javascript:void(0);'>菜单_2_1</a> <ul> <li><em></em><a href='javascript:void(0);'>菜单_3_1</a> <ul> <li><em></em><a href='javascript:void(0);'>菜单_4_1</a> <ul> <li><a href='javascript:void(0);'>菜单_5_1</a></li> <li id='end_wuming_ren'><a href='javascript:void(0);'>菜单_5_2</a></li> </ul> </li> <li id='end_wuming_ren'><em></em><a href='javascript:void(0);'>菜单_4_2</a> <ul> <li><a href='javascript:void(0);'>菜单_5_1</a></li> <li id='end_wuming_ren'><a href='javascript:void(0);'>菜单_5_2</a></li> </ul> </li> </ul> </li> <li id='end_wuming_ren'><em></em><a href='javascript:void(0);'>菜单_3_2</a> <ul> <li><em></em><a href='javascript:void(0);'>菜单_4_1</a> <ul> <li><a href='javascript:void(0);'>菜单_5_1</a></li> <li id='end_wuming_ren'><a href='javascript:void(0);'>菜单_5_2</a></li> </ul> </li> <li id='end_wuming_ren'><em></em><a href='javascript:void(0);'>菜单_4_2</a> <ul> <li><a href='javascript:void(0);'>菜单_5_1</a></li> <li id='end_wuming_ren'><a href='javascript:void(0);'>菜单_5_2</a></li> </ul> </li> </ul> </li> </ul> </li> <li id='end_wuming_ren'><em></em><a href='javascript:void(0);'>菜单_2_2</a> <ul> <li><em></em><a href='javascript:void(0);'>菜单_3_1</a> <ul> <li><em></em><a href='javascript:void(0);'>菜单_4_1</a> <ul> <li><a href='javascript:void(0);'>菜单_5_1</a></li> <li id='end_wuming_ren'><a href='javascript:void(0);'>菜单_5_2</a></li> </ul> </li> <li id='end_wuming_ren'><em></em><a href='javascript:void(0);'>菜单_4_2</a> <ul> <li><a href='javascript:void(0);'>菜单_5_1</a></li> <li id='end_wuming_ren'><a href='javascript:void(0);'>菜单_5_2</a></li> </ul> </li> </ul> </li> <li id='end_wuming_ren'><em></em><a href='javascript:void(0);'>菜单_3_2</a> <ul> <li><em></em><a href='javascript:void(0);'>菜单_4_1</a> <ul> <li><a href='javascript:void(0);'>菜单_5_1</a></li> <li id='end_wuming_ren'><a href='javascript:void(0);'>菜单_5_2</a></li> </ul> </li> <li id='end_wuming_ren'><em></em><a href='javascript:void(0);'>菜单_4_2</a> <ul> <li><a href='javascript:void(0);'>菜单_5_1</a></li> <li id='end_wuming_ren'><a href='javascript:void(0);'>菜单_5_2</a></li> </ul> </li> </ul> </li> </ul> </li> </ul> </li> </ul> </div> <script type="text/javascript"> (function(e){ for(var _obj=document.getElementById(e.id).getElementsByTagName(e.tag),i=-1,em;em=_obj[++i];){ em.onclick = function(){ //onmouseover var ul = this.nextSibling; if(!ul){return false;} ul = ul.nextSibling; if(!ul){return false;} if(e.tag != 'a'){ ul = ul.nextSibling; if(!ul){return false;} } //a 标签控制 隐藏或删除该行 for(var _li=this.parentNode.parentNode.childNodes,n=-1,li;li=_li[++n];){ if(li.tagName=="LI"){ for(var _ul=li.childNodes,t=-1,$ul;$ul=_ul[++t];){ switch($ul.tagName){ case "UL": $ul.className = $ul!=ul?"" : ul.className?"":"off"; break; case "EM": $ul.className = $ul!=this?"" : this.className?"":"off"; break; } } } } } }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) })({id:'menu_wuming_ren',tag:'em'}); </script> </body> </html>
本文来自武鸣人网站,转载请注明出处