keyboard_navigation.html 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <!DOCTYPE html>
  2. <HTML>
  3. <HEAD>
  4. <TITLE> ZTREE DEMO - Keyboard navigation </TITLE>
  5. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  6. <link rel="stylesheet" href="../../../css/demo.css" type="text/css">
  7. <link rel="stylesheet" href="../../../css/zTreeStyle/zTreeStyle.css" type="text/css">
  8. <script type="text/javascript" src="../../../js/jquery-1.4.4.min.js"></script>
  9. <script type="text/javascript" src="../../js/keyboard_navigation.js"></script>
  10. <script type="text/javascript" src="../../../js/jquery.ztree.core.js"></script>
  11. <script type="text/javascript" src="../../../js/jquery.ztree.exedit.js"></script>
  12. <SCRIPT type="text/javascript">
  13. var setting = {
  14. data: {
  15. simpleData: {
  16. enable: true
  17. }
  18. }
  19. };
  20. var zNodes =[
  21. { id:1, pId:0, name:"Custom Icon 01", open:true, iconSkin:"pIcon01", accesskey: 'c'},
  22. { id:11, pId:1, name:"leaf node 01", iconSkin:"icon01", accesskey: 'l'},
  23. { id:12, pId:1, name:"leaf node 02", iconSkin:"icon02"},
  24. { id:13, pId:1, name:"parent node 03", iconSkin:"pIcon01", accesskey: 'p'},
  25. { id:131, pId:13, name:"leaf node 01", iconSkin:"icon01"},
  26. { id:132, pId:13, name:"leaf node 02", iconSkin:"icon02"},
  27. { id:133, pId:13, name:"leaf node 03", iconSkin:"icon03"},
  28. { id:2, pId:0, name:"Custom Icon 02", open:true, iconSkin:"pIcon02"},
  29. { id:21, pId:2, name:"leaf node 01", iconSkin:"icon04"},
  30. { id:22, pId:2, name:"leaf node 02", iconSkin:"icon05"},
  31. { id:23, pId:2, name:"leaf node 03", iconSkin:"icon06"},
  32. { id:3, pId:0, name:"no Custom Icon", open:true, accesskey: 'n' },
  33. { id:31, pId:3, name:"leaf node 01"},
  34. { id:32, pId:3, name:"leaf node 02"},
  35. { id:33, pId:3, name:"leaf node 03"}
  36. ];
  37. var $ = jQuery;
  38. $(document).ready(function()
  39. {
  40. var element = "#treeDemo";
  41. var zTree = $.fn.zTree.init($(element), setting, zNodes);
  42. // Initialize keyboard navigation
  43. $.fn.zTreeKeyboardNavigation(zTree, document.body);
  44. });
  45. </SCRIPT>
  46. <style type="text/css">
  47. .ztree li > a
  48. {
  49. border-left: 1px solid white;
  50. }
  51. .ztree li > a.curSelectedNode {
  52. border-radius: 3px;
  53. }
  54. .ztree li span.button.pIcon01_ico_open{margin-right:2px; background: url(../../../css/zTreeStyle/img/diy/1_open.png) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}
  55. .ztree li span.button.pIcon01_ico_close{margin-right:2px; background: url(../../../css/zTreeStyle/img/diy/1_close.png) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}
  56. .ztree li span.button.pIcon02_ico_open, .ztree li span.button.pIcon02_ico_close{margin-right:2px; background: url(../../../css/zTreeStyle/img/diy/2.png) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}
  57. .ztree li span.button.icon01_ico_docu{margin-right:2px; background: url(../../../css/zTreeStyle/img/diy/3.png) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}
  58. .ztree li span.button.icon02_ico_docu{margin-right:2px; background: url(../../../css/zTreeStyle/img/diy/4.png) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}
  59. .ztree li span.button.icon03_ico_docu{margin-right:2px; background: url(../../../css/zTreeStyle/img/diy/5.png) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}
  60. .ztree li span.button.icon04_ico_docu{margin-right:2px; background: url(../../../css/zTreeStyle/img/diy/6.png) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}
  61. .ztree li span.button.icon05_ico_docu{margin-right:2px; background: url(../../../css/zTreeStyle/img/diy/7.png) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}
  62. .ztree li span.button.icon06_ico_docu{margin-right:2px; background: url(../../../css/zTreeStyle/img/diy/8.png) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}
  63. </style>
  64. </HEAD>
  65. <BODY>
  66. <h1>Keyboard navigation</h1>
  67. <h6>[ File Path: super/keyboard_navigation.html ]</h6>
  68. <div class="content_wrap">
  69. <div class="zTreeDemoBackground left">
  70. <ul id="treeDemo" class="ztree"></ul>
  71. </div>
  72. <div class="right">
  73. <ul class="info">
  74. <li class="title"><h2>1. Explanation of setting</h2>
  75. <ul class="list">
  76. <li>Keyboard navigation does not require special configuration setting.</li>
  77. <li>It does require that the keyboard_navigation.js file is loaded and the function initialized.</li>
  78. </ul>
  79. </li>
  80. <li class="title"><h2>2. Explanation of navigation</h2>
  81. <ul class="list">
  82. <li>Home: home key (keycode 36) Goes to the first root element is visible</li>
  83. <li>End: end key (keycode 35) Goes to the last leaf node and will expand nodes and scroll the element into view</li>
  84. <li>Down: right cursor key (keycode 39) Goes to the next visible node in the tree following the hierarchy</li>
  85. <li>Next: down cursor key (keycode 40) Goes to the next visible node at the same level</li>
  86. <li>Up: up cursor key (keycode 37) Goes to the prior visible node at the same level</li>
  87. <li>Previous: left cursor key (keycode 38) Goes to the prior visible node following the hierarchy</li>
  88. <li>Toggle: space key (keycode 32) Toggles the expand/collapse state of a parent node</li>
  89. </ul>
  90. </li>
  91. </ul>
  92. </div>
  93. </div>
  94. </BODY>
  95. </HTML>