【发布时间】:2011-12-04 21:02:32
【问题描述】:
我是 Jquery 和 JS Tree 的新手,但我正在学习喜欢它。我已经设定 使用 php 生成的 xml 建立一个树形菜单(参见下面的代码)。它作为 预期有一个例外 - 链接无效。
我知道有些基本的东西我不明白。短期我只是 希望链接作为普通链接起作用。从长远来看,我希望他们 触发将在页面上重新加载特定 div 的 ajax 调用。
谁能指出我正确的方向?非常感谢您的帮助!
$(function () {
$("#mainMenu").jstree({
xml_data : { data : <?php $menu->deliver(); ?> },
core : { animation : 1000 }
ui : { select_limit : 1, selected_parent_close : false },
themes : { theme : "default", dots : true, icons : false },
types : { types : { "heading" : { select_node : true } } },
plugins : [ "themes", "xml_data", "ui", "types" ]
});
});
示例 xml(单项):
"<root><item id='pubPages_home' parent_id='0'><content><name href='?
a=pubPages&f=home'>Public Home</name></content></item><root>"
【问题讨论】:
-
哪些链接不起作用?如果单击节点名称?你想发生什么?你能提供jsfiddle示例吗?
-
@Radek 节点按预期工作(打开和关闭树)。 a 标签href 不起作用。将鼠标悬停在链接上时,浏览器会识别它们,但单击不会将浏览器发送到链接。我怀疑 JS Tree 调用了 preventDefault() 来点击 a 标签。
标签: jquery jquery-plugins jstree