2016-06-28 146 views
2

我正在使用jstree在MVC Razor頁面中顯示信息。 jstree的代碼如下所示:JSTree上的鼠標懸停事件

$('#app_container').jstree({ 
       'core': { 
        'data': { 
         "url": "/controller/methodname", 
         "data": function (node) { 
           return { "id": node.id, "parent":node.parent }; 
         } 
        } 

       }, 
       "plugins": ["sort"] 
     }); 

我想在每個節點上添加一個鼠標懸停事件,以便顯示其他信息。我看過documentation,但我不確定我必須在哪裏添加活動。

回答

2

嘗試,因爲事件偵聽器,完全獨立於jstree初始化代碼:

$('#app_container').on("hover_node.jstree", function (node) { 
    // Your code here 
});