2

使用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”这样的方法?

谢谢

4

1 回答 1

0

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

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

对此:

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

你会得到当前节点选择的颜色,你可以在这里试一试

于 2010-08-24T00:23:33.847 回答