读书人

treeview点击节指名称不展开、收缩节点

发布时间: 2012-11-03 10:57:43 作者: rapoo

treeview点击节点名称不展开、收缩节点
原文:http://zhoupuyue.iteye.com/blog/828300

treeview点击节点名称不展开、收缩节点
文章分类:Web前端
修改jquery.treeview.js文件中的applyClasses方法(注释掉两行代码):

修改后的applyClasses方法如下:



Js代码
1.applyClasses: function(settings, toggler) {
2. /*
3. this.filter(":has(>ul):not(:has(>a))").find(">span").click(function(event) {
4. toggler.apply($(this).next());
5. }).add( $("a", this) ).hoverClass();
6. */
7.
8. if (!settings.prerendered) {
9. // handle closed ones first
10. this.filter(":has(>ul:hidden)")
11. .addClass(CLASSES.expandable)
12. .replaceClass(CLASSES.last, CLASSES.lastExpandable);
13.
14. // handle open ones
15. this.not(":has(>ul:hidden)")
16. .addClass(CLASSES.collapsable)
17. .replaceClass(CLASSES.last, CLASSES.lastCollapsable);
18.
19. // create hitarea
20. this.prepend("<div class=\"" + CLASSES.hitarea + "\"/>").find("div." + CLASSES.hitarea).each(function() {
21. var classes = "";
22. $.each($(this).parent().attr("class").split(" "), function() {
23. classes += this + "-hitarea ";
24. });
25. $(this).addClass( classes );
26. });
27. }
28.
29. // apply event to hitarea
30. this.find("div." + CLASSES.hitarea).click( toggler );
31. },

读书人网 >编程

热点推荐