很漂亮的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>漂亮鼠标感应滑动切换导航菜单_武鸣人</title> <style type="text/css"> body{ margin:10px; padding:10px; } a:link { text-decoration: none;color: blue} a:active { text-decoration:blink} a:hover { text-decoration:underline;color: red} a:visited { text-decoration: none;color: green} body,td,div,span,li{ font-size:12px; } .title01,.title02{ color:#00b; font-weight:bold; } #DoorP{ width:200px; height:300px; padding:0px; background:#FFFCF2; overflow:hidden; } .title01{ width:100%; height:25px; background:#FFFCF2; cursor:pointer; } .title02{ width:100%; height:25px; background:#FFFCF2; cursor:pointer; } .wuming__ren{ background:#FFFCF2; border-bottom:2px solid #fff; overflow:hidden; color:#666; padding-left:4px; padding-right:4px; line-height:18px; } .www_wuming_ren { width:202px; } .www_wuming_ren .b1, .www_wuming_ren .b2, .www_wuming_ren .b3, .www_wuming_ren .b4 { font-size:1px; display:block; background:#FFFCF2; overflow: hidden; } .www_wuming_ren .b1, .www_wuming_ren .b2, .www_wuming_ren .b3 { height:1px; } .www_wuming_ren .b2, .www_wuming_ren .b3, .www_wuming_ren .b4 { background:#FFFCF2; border-left:1px solid #C7BC98; border-right:1px solid #C7BC98; } .www_wuming_ren .b1 { margin:0 4px; background:#C7BC98; } .www_wuming_ren .b2 { margin:0 2px; border-width:0 2px; } .www_wuming_ren .b3 { margin:0 1px; } .www_wuming_ren .b4 { height:2px; margin:0; } .www_wuming_ren .c1 { margin:0 5px; background:#C7BC98; } .www_wuming_ren .c2 { margin:0 3px; border-width:0 2px; } .www_wuming_ren .c3 { margin:0 2px; } .www_wuming_ren .c4 { height:2px; margin: 0 1px; } .www_wuming_ren .wuming_ren { display:block; background:transparent; border-left:1px solid #C7BC98; border-right:1px solid #C7BC98; font-size:0.9em; text-align:justify; } </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="www_wuming_ren"> <b class="b1 c1"></b> <b class="b2 c2"></b> <b class="b3 c3"></b> <b class="b4 c4"></b> <div class="wuming_ren"> <div id="DoorP"> <table> <tr> <td align="center"> 武鸣人一号菜单 </td> </tr> </table> <div class="wuming__ren" align="center"> <a href="#">武鸣人一号分类</a><br/>武鸣人二号分类<br/>武鸣人三号分类<br/> </div> <b class="b1"></b> <b class="b2"></b> <b class="b3"></b> <b class="b4"></b> <table> <tr> <td align="center"> 武鸣人二号菜单 </td> </tr> </table> <div class="wuming__ren" align="center"> <a href="#">武鸣人四号分类</a><br/>武鸣人五号分类<br/>武鸣人六号分类<br/> </div> <b class="b1"></b> <b class="b2"></b> <b class="b3"></b> <b class="b4"></b> <table> <tr> <td align="center"> 武鸣人三号菜单 </td> </tr> </table> <div class="wuming__ren" align="center"> <a href="#">武鸣人七号分类</a><br/>武鸣人八号分类<br/>武鸣人九号分类<br/> </div> </div></div> <b class="b4 c4"></b> <b class="b3 c3"></b> <b class="b2 c2"></b> <b class="b1 c1"></b> <script type="text/javascript"> var open = 2; var openState = new Array(); var closeState = new Array(); var dH = 220; function $(id){ if(document.getElementById(id)) { return document.getElementById(id); }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) else { alert("没有找到!"); } } function $tag(id,tagName){ return $(id).getElementsByTagName(tagName) } function closeMe(Cid,Oid){ var h = parseInt(Ds[Cid].style.height); //alert(h); if(h > 2) { h = h - Math.ceil(h/3); Ds[Cid].style.height = h+"px"; } else { openMe(Oid); clearTimeout(closeState[Cid]); return false; } closeState[Cid] = setTimeout("closeMe("+Cid+","+Oid+")"); }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) function openMe(Oid){ var h = parseInt(Ds[Oid].style.height); //alert(h); if(h < dH) { h = h + Math.ceil((dH-h)/3); Ds[Oid].style.height = h+"px"; } else { clearTimeout(openState[Oid]); return false; } openState[Oid] = setTimeout("openMe("+Oid+")"); } var Ds = $tag("DoorP","div"); var Ts = $tag("DoorP","table"); if(Ds.length != Ts.length) { alert("标题和内容数目不相同!"); } for(var i = 0 ; i < Ds.length ; i++) { if(i==open) { Ds[i].style.height = dH+"px"; Ts[i].className="title01"; } else { Ds[i].style.height = "0px"; Ts[i].className="title02"; }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) Ts[i].value = i; Ts[i].onmouseover = function(){ if(open==this.value) { return false; } Ts[open].className="title02"; Ts[this.value].className="title01"; for(var i = 0 ; i < openState.length ; i++) { clearTimeout(openState[i]); clearTimeout(closeState[i]); } closeMe(open,this.value); //openMe(this.value); open = this.value; } }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) function showDiv(id){ Ds[id].style.height=dH+"px"; Ds[open].style.height="0px"; open = id; } </script> </body> </html>
本文来自武鸣人网站,转载请注明出处