我只想禁用 jsTree View 上的右箭头键。我尝试使用“热键”禁用它
$('#folder').jstree({
'hotkeys':{'right':false},
'core':{ 'themes': { "icons": true }}
})
没成功。然后我尝试了
$('#folder').jstree({
'hotkeys':{'right':false},
'core':{ 'themes': { "icons": true }}
}).keydown(function(e){
// right arrow
if ((e.keyCode || e.which) == 39)
{
e.preventDefault()
e.stopImmediatePropagation()
e.stopPropagation()
e.detail.keyboardEvent.preventDefault();
return false;
}
});
这也行不通。在文档中它说
To override any of those - just specify your own function, to disable - just set to false.
但我无法让它发挥作用。你能帮我解决这个问题吗?谢谢
最佳答案
我已经使用 jsTree api 中的 $.jstree.defaults.core.keyboard
解决了问题,而不是使用“Hotkeys”插件。 Hotkeys 插件内置于 jsTree 中。
所以它会在核心
$('#folder').jstree({
'core':{
'keyboard':{'right':false},
'themes': { "icons": true},
'data': {
"dataType": "json"
}
})
关于javascript - 如何禁用 jsTree 上的热键(arrowKeys)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56755441/