有一个需求:菜单导航条需要依据不同的权限动态提取出来。计划是将功能模块与用户权限之间的关系保持到一个配置表中。所以功能菜单的话就需要动态提取出来再显示。借助JQuery框架实现一段动态菜单显示的方案。 一、学习一款它的插件TreeView 这个插件能够把无序列表转换成可展开与收缩的Tree。 <!DOCTYPE HTML PUBLIC "-//W <html> <head> <script src="http://code./jquery-latest.js"></script> <link rel="stylesheet" href="screen.css" type="text/css" /> <link rel="stylesheet" href="jquery.treeview.css" type="text/css" /> <script type="text/javascript" src="jquery.treeview.js"></script> <script> $(document).ready(function(){ $("#example").treeview(); }); </script> </head> <body> <ul id="example" class="filetree"> <li><span class="folder">Folder 1</span> <ul> <li><span class="file">Item 1.1</span></li> </ul> </li> <li><span class="folder">Folder 2</span> <ul> <li><span class="folder">Subfolder 2.1</span> <ul> <li><span class="file">File <li><span class="file">File </ul> </li> <li><span class="file">File 2.2</span></li> </ul> </li> <li class="closed"><span class="folder">Folder 3 (closed at start)</span> <ul> <li><span class="file">File 3.1</span></li> </ul> </li> <li><span class="file">File 4</span></li> </ul> </body> </html> 可以参考 : http://docs./Plugins/Treeview |
|