src/main/resources/public/js/zTree_v3/demo/js/keyboard_navigation.js
(开头部分) 6KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/*
* JQuery zTree keyboard navigation extension
* zTree v3.5.42 or later
* http://www.xbrlquery.com/
*
* Copyright (c) 2019 Bill Seddon
*
* Licensed same as jquery - MIT License
* http://www.opensource.org/licenses/mit-license.php
*
* Date: 2020-02-18
*/
( function ($)
{
/**
* Creates a function that adds keyboard navigation:
* Home: home key (keycode 36) Goes to the first root element is visible
* End: end key (keycode 35) Goes to the last leaf node and will expand nodes and scroll the element into view
* Down: right cursor key (keycode 39) Goes to the next visible node in the tree following the hierarchy
* Next: down cursor key (keycode 40) Goes to the next visible node at the same level
* Up: up cursor key (keycode 37) Goes to the prior visible node at the same level
* Previous: left cursor key (keycode 38) Goes to the prior visible node following the hierarchy
* Toggle: space key (keycode 32) Toggles the expand/collapse state of a parent node
*/
$.fn.zTreeKeyboardNavigation = function(zTree, element)
{
if (typeof element === 'string' || element instanceof String)
{
element = $(element);
}
var rootNodes = zTree.getNodes();
if ( ! rootNodes ) return;
var focusSelectedNode = function()
{
if( ( selectedNodes = zTree.getSelectedNodes() ) && selectedNodes.length )
{
$("#" + selectedNodes[0].tId ).focus();
}
}
$(element).bind( 'keydown', function( e )
{
var selectedNodes = zTree.getSelectedNodes();
var selectedNode = selectedNodes.length ? selectedNodes[0] : null;
var processSpace = function()
{
// If there are no nodes or the selected node is not a parent, get out
if ( selectedNode && selectedNode.isParent )
{
// Toggle the node
zTree.expandNode( selectedNode, null, null, null, false );
}
}
var processHome = function()
{
后面还有 195 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。