【问题标题】:how to trigger the click event without clear default click event on jstree如何在没有清除jstree上的默认点击事件的情况下触发点击事件
【发布时间】:2010-08-23 23:37:17
【问题描述】:

使用jstree,我使用下一个代码来触发点击,但是,我看不到默认点击事件,比如:点击时的蓝色背景,

这是我的代码:

<div id="wrap">
    <div id="header">header</div>
    <div id="main">
        <div id="demo1" style="float:left;width:50%;">
            <ul>
                <li>
                    <a id='a' href="">aaa</a>
                    <!-- UL node only needed for children - omit if there are no children -->
                    <ul>
                        <li><a id="a_1" href="#"> bbb</a></li>
                        <li><a id="a_2" href="#"> ccc</a></li>
                    </ul>
                </li>
            </ul>

        </div>
        <div id="content">www</div>
    </div>
</div>

<div id="footer">
    footer
</div>
<script type="text/javascript">
    $(function () {
    $("#demo1").jstree({
        "themes": {
        "theme": "default",
        "dots": true,
        "icons": true,
        "url": "themes/default/style.css"
      },

        "plugins" : [ "themes", "html_data" ]
    });
    $('#a_1').click(function(){
            $('#content').html('bbb \'s content')
            //return false;
        })
    $('#a_2').click(function(){
            $('#content').html('ccc \'s content')
            //return false;
        })
});
</script>

我找到了一些这样的代码:

.bind("create.jstree", function (e, data) {
            alert(data)
        })

它的意思是:当有人创建一个新文件时提醒数据,

所以

jstree 有没有类似“click.jstree”的方法?

谢谢

【问题讨论】:

    标签: javascript jquery jquery-plugins click jstree


    【解决方案1】:

    在事件方面你所拥有的一切都很好,你只是缺少一个插件......在新的 1.0 模型中,如果你只是从这里更改你的插件,那么 ui 位是一个单独的插件:

    "plugins" : [ "themes", "html_data" ]
    

    到这里:

    "plugins" : [ "themes", "html_data", "ui" ]
    

    您将获得当前节点选择颜色,you can give it a try here

    【讨论】:

      猜你喜欢
      • 2017-12-15
      • 1970-01-01
      • 1970-01-01
      • 2020-06-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多