jQuery.treeview

  • 1578
  • 0

摘要:jQuery.treeview

為免記憶退化後什麼都沒留下,還是做個簡單的記錄…

https://github.com/jzaefferer/jquery-treeview/blob/master/jquery.treeview.js

如果節點是連結,無法展開其下的結點,可以這樣寫:


$("#CategoryUL").delegate("li a", "click", $("#CategoryUL").data("toggler"));

另外,在程式的最後加上 untreeview,移除效果。


//...
	// classes used by the plugin
	// need to be styled via external stylesheet, see first example
	$.treeview = {};
	var CLASSES = ($.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"
	});
	
    $.extend($.fn, {
        untreeview: function() {
            for (var i in CLASSES) {
                this.find("*").andSelf().removeClass(CLASSES[i]);
            }
            this.removeClass("treeview");
        }
    });
//..