0
我使用帶有UL的jstree,每個節點都是一個導航href,它通過php包含在每個html頁面中。jstree - 覆蓋取決於當前網址的cookie
Jstree代碼:
$(function(){
$("#treeview").jstree({
"themes" : {
"theme" : "default",
"dots" : false,
"icons" : false
},
"ui" : {
"selected_parent_close" : "false",
"select_multiple_modifier" : "false",
},
"core": {
"animation": 500
},
"plugins" : [ "themes", "html_data", "ui", "cookies" ]
});
$("#treeview").bind("reselect.jstree", function() {
$("#treeview").bind("select_node.jstree", function (e, data) {
document.location = data.rslt.obj.children("a").attr("href");
});
});
});
Cookie的工作不錯,但問題是如何覆蓋的cookie選擇的節點,當(且僅當)的導航網址是根的一個節點?如果它是一個根節點,我希望它是開放的。當從外部來源或沒有樹的站點中的其他頁面導航到樹頁面時發生這種情況,因此cookie設置不正確。
正在使用jquery 1.7.2,jstree 1.0。所有li id與頁面名稱相同,即對於href「page1」,相關的li id是「page1」。