【发布时间】:2016-09-26 22:32:59
【问题描述】:
我已经让 JStree 与打开节点的 href 链接的绑定函数一起工作。 但是,它现在破坏了我的 Bootstrap 选项卡部分。
$('#jstree').bind("select_node.jstree", function (e, data) {
var href = data.node.a_attr.href;
document.location.href = href;
<ul class="nav nav-tabs">
<li class="active"><a href="#1" data-toggle="tab" id=tab1>
Tab1
</a>
</li>
</ul>
<div class="tab-content ">
<div class="tab-pane active" id="1">
//some content
</div>
有没有更好的方法将节点绑定到它的href?
document.location.href = href;
似乎将 href 应用于整个 DOM 而不是专门应用于节点。因此会影响所有 href 链接和选项卡功能……我猜……
这件事有什么帮助吗?
谢谢
更新: 看来问题不在于绑定。但是对于 jstree 本身...一旦我将其删除...
$('#jstree').jstree({
'plugins': ["sort"],
'core' : {
'data' : {
'url' : "fetch_tree.php",
'data' : function (node) {
return { 'id' : node.id };
},
"dataType" : "json"
}
},'check_callback' : true
})
引导选项卡功能有效...
【问题讨论】: