http://jquery.bassistance.de/treeview/demo/?2
这个链接下 的sample1 是 filetree,样式比较好看.
sample3 是 treeview-red ,样子不好看,但是能够 在展开1个子节点时,自动收起其它同级节点。
怎样让filetree也有此效果?
在线等高手解答~~

解决方案 »

  1.   

    filetree的样式是 html,要自动收缩加上这个unique: true
        // third example
        $("#red").treeview({
            animated: "fast",
            collapsed: true,
            unique: true,
            persist: "cookie",
            toggle: function() {
                window.console && console.log("%o was toggled", this);
            }
        });
      

  2.   

    unique:true
    这一句加在
     
    $(document).ready(function() {
                $("#browser").treeview({unique:true});
                //ajax的发送函数  url          参数1  值1                                      接收函数                        回传的data类型
            });中报错,对象不支持该方法或属性
      

  3.   

      // first example
        $("#browser").treeview({unique:true});
    报错~
      

  4.   

    那你就再试一下其他属性啰,反正我是看example 2也是这样,然后对比得出的,我也没试过。
      

  5.   

    这是filetree <li><span>的一些属性,// classes used by the plugin
    // need to be styled via external stylesheet, see first example
    var CLASSES = $.fn.treeview.classes = {
    open: "open",
    closed: "closed",
    expandable: "expandable",
    expandableHitarea: "expandable-hitarea",
    lastExpandableHitarea: "lastExpandable-hitarea",
    collapsable: "collapsable",
    collapsableHitarea: "collapsable-hitarea",
    lastCollapsableHitarea: "lastCollapsable-hitarea",
    lastCollapsable: "lastCollapsable",
    lastExpandable: "lastExpandable",
    last: "last",
    hitarea: "hitarea"
    };我太菜了,试了4小时,让父节点前面的-号变成了加号,但是父节点的子节点没有收起来。
    document.getElementbyId("fathernode").className="expandable";
    ocument.getElementbyId("fatherSpan").className="expandable-hitarea";
      

  6.   

    我不知道你怎么整的,我一加unique:true就完全达到你的要求了。你出现问题是其他代码的原因了。你示例没下载完整吧。
      

  7.   

    确实,我少引用了jquery.cookie.js.  谢谢~