最近一个项目 需要用到jstree 这个jquery插件,就研究了下,做目录树 菜单还是很强大的,下面对经常会用到几个用法做下说明。
1. 首先页面 引用 jquery.jstree
2. html :
<div id="cate_tree" class="jstree fl">
<ul>
<li id="0" class="jstree-closed jstree-unchecked">
<a href="#" class="jstree-clicked">
<ins class="jstree-checkbox"> </ins>
All Product
</a>
<ul style="">
{foreach $categories as $cat}
<li id="{$cat.id}" class="jstree-closed jstree-unchecked">
<a href="#" class="jstree-clicked">
<ins class="jstree-checkbox"> </ins>
{$cat.name}
</a>
{if $cat.sub|@count > 0}
<ul style="">
{forea