jQuery侧边栏实现代码
先给大家展示下实现效果图,如果亲感觉是您想要的效果,请参考本代码。
实现代码如下所示:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>JavaScript菜单侧边展开(改良版)</title> </head> <body> <ul id="navigation"> <li><a href="#">系统管理</a> <ul> <li><a href="#">地区设置</a></li> <li><a href="#">分行设置</a></li> <li><a href="#">银行操作用户设置</a></li> <li><a href="#">密码修改</a></li> </ul> </li> <li><a href="#">学校管理</a> <ul> <li><a href="#">学校设置</a></li> <li><a href="#">学校查询</a></li> </ul> </li> <li><a href="#">基础信息管理</a></li> <li><a href="#">统计系统查询</a></li> </ul> <script src="jquery-1.11.1.js"></script> <script> var $j = jQuery.noConflict(); $j(function(){ var lis = document.getElementById("navigation").getElementsByTagName("li"); for (var i=0; i<lis.length; i++) { lis[i].onmouseover=function() { var subMenu = this.getElementsByTagName("ul")[0]; subMenu.style.display = "block"; var subcolor = this.getElementsByTagName("a")[0]; subcolor.style.background = "lightblue"; } lis[i].onmouseout=function() { var subMenu = this.getElementsByTagName("ul")[0]; subMenu.style.display = "none"; var subcolor = this.getElementsByTagName("a")[0]; subcolor.style.background = ""; } } }); </script> <script src="jquery-1.11.1.js"></script> </body> </html>
相关推荐
EdwardSiCong 2020-11-23
85477104 2020-11-17
hhanbj 2020-11-17
81427005 2020-11-11
seoppt 2020-09-13
honeyth 2020-09-13
WRITEFORSHARE 2020-09-13
84483065 2020-09-11
momode 2020-09-11
85477104 2020-08-15
83510998 2020-08-08
82550495 2020-08-03
tthappyer 2020-08-03
84901334 2020-07-28
tthappyer 2020-07-25
TONIYH 2020-07-22
tztzyzyz 2020-07-20
83510998 2020-07-18
81463166 2020-07-17