【问题标题】:how to add class to `li` tag in fancy tree jquery如何在花哨的树jQuery中将类添加到`li`标签
【发布时间】:2015-09-11 17:57:17
【问题描述】:

如何在花哨的树 jquery 中将类添加到 li 标记。
我尝试使用extraClasses,但它将类添加到跨度标签中有人可以帮助我吗?

 {title: "Node 2", folder: true, lazy: true, 
        treeMode: "struct", 
        keyType: "root", key: "_structtree_", 
        refKey: "_structtree_", 
        extraClasses: "scioStructureTree" }

请:)

【问题讨论】:

    标签: jquery css fancytree


    【解决方案1】:

    我在重新设计 fancytree 时遇到了类似的问题。研究了fancytree的源码后找到了解决办法

    $("<selector to your html element>").fancytree({
       ... other stuff ...
       renderNode: function(event, data) {
          setTimeout(function() {
              $(node.li).addClass("your className")
          }, 20);
       }
    })
    

    20 毫秒超时确保节点完全呈现,因此类不会随着呈现而被删除。

    你可以把node.li当作一个普通的javascript对象,$(node.li)当作一个普通的JQuery对象

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-21
      • 2014-11-16
      • 2014-03-24
      相关资源
      最近更新 更多