【问题标题】:JSTree binding issue with hrefJSTree 与 href 的绑定问题
【发布时间】: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
}) 

引导选项卡功能有效...

【问题讨论】:

    标签: jquery html jstree


    【解决方案1】:

    所以我找到了一个“解决方法”

    使用..

    <a  data-target="#1" data-toggle="tab" id=tab1>
    

    而不是

    <a  href="#1" data-toggle="tab" id=tab1>
    

    允许标签在 jstree 旁工作。但我找不到合适的解决方案。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-07-23
      • 2020-12-22
      • 2010-12-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-19
      相关资源
      最近更新 更多