jquery的filetree怎样才能自动收起节点?

hinada99 2011-11-18 07:51:10
http://jquery.bassistance.de/treeview/demo/?2
这个链接下 的sample1 是 filetree,样式比较好看.
sample3 是 treeview-red ,样子不好看,但是能够 在展开1个子节点时,自动收起其它同级节点。
怎样让filetree也有此效果?
在线等高手解答~~
...全文
162 8 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
hinada99 2011-11-19
  • 打赏
  • 举报
回复
// first example
$("#browser").treeview({unique:true});
报错~
hinada99 2011-11-19
  • 打赏
  • 举报
回复
unique:true
这一句加在
 
$(document).ready(function() {
$("#browser").treeview({unique:true});
//ajax的发送函数 url 参数1 值1 接收函数 回传的data类型
});

中报错,对象不支持该方法或属性
hinada99 2011-11-19
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 p2227 的回复:]

我不知道你怎么整的,我一加

unique:true

就完全达到你的要求了。你出现问题是其他代码的原因了。你示例没下载完整吧。
[/Quote]
确实,我少引用了jquery.cookie.js. 谢谢~
p2227 2011-11-19
  • 打赏
  • 举报
回复
我不知道你怎么整的,我一加

unique:true

就完全达到你的要求了。你出现问题是其他代码的原因了。你示例没下载完整吧。
hinada99 2011-11-19
  • 打赏
  • 举报
回复
高手能帮忙整出来吗?
hinada99 2011-11-19
  • 打赏
  • 举报
回复
这是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";

p2227 2011-11-19
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 hinada99 的回复:]

// first example
$("#browser").treeview({unique:true});
报错~
[/Quote]那你就再试一下其他属性啰,反正我是看example 2也是这样,然后对比得出的,我也没试过。
p2227 2011-11-18
  • 打赏
  • 举报
回复
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);
}
});

87,997

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧