本文实例讲述了Javascript实现的经典文件树菜单效果。分享给大家供大家参考。具体如下:
这是一款简单的Javascript文件树菜单,经典的树形菜单,特别是文件夹的样式比较经典,折叠和展开也很流畅自然,不过本款菜单有一个缺点,就是菜单的数据写在JS的数组里,这样一来多多少少对菜单内容的修改造成一定麻烦。
先来看看运行效果截图:
在线演示地址如下:
http://demo.jb51.net/js/2015/js-file-tree-style-menu-codes/
具体代码如下:
简单的文件树效果 .tree{width:200px;border:2px inset #fff;height:400px;padding:5px;overflow:auto;} .tree dd,.tree dt, .tree dl{margin:0;padding:0;overflow:hidden;} .tree dd{margin-left:18px;} .tree dt{background:url(images/tree-bg.png) no-repeat 0 0px;padding-left:35px;line-height :20px;height:20px;} .tree dt.node-close{background-position: 0 -24px;} .tree dt.node-open{background-position: 0 -58px;} .tree dt a{color:#000;text-decoration:none;font: 12px/1 verdana;line-height :12px;_line-height :16px;} .tree dt a:hover{background:#0A246A;color:#fff;}
希望本文所述对大家的Javascript程序设计有所帮助。



