edit.html 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
  5. <title>jQuery treeview</title>
  6. <link rel="stylesheet" href="../jquery.treeview.css" />
  7. <link rel="stylesheet" href="screen.css" />
  8. <script src="../lib/jquery.js" type="text/javascript"></script>
  9. <script src="../lib/jquery.cookie.js" type="text/javascript"></script>
  10. <script src="../jquery.treeview.js" type="text/javascript"></script>
  11. <script src="../jquery.treeview.edit.js" type="text/javascript"></script>
  12. <script type="text/javascript">
  13. $(function() {
  14. $("#browser").treeview();
  15. $("#add").click(function() {
  16. var branches = $("<li><span class='folder'>New Sublist</span><ul>" +
  17. "<li><span class='file'>Item1</span></li>" +
  18. "<li><span class='file'>Item2</span></li></ul></li>").appendTo("#browser");
  19. $("#browser").treeview({
  20. add: branches
  21. });
  22. branches = $("<li class='closed'><span class='folder'>New Sublist</span><ul><li><span class='file'>Item1</span></li><li><span class='file'>Item2</span></li></ul></li>").prependTo("#folder21");
  23. $("#browser").treeview({
  24. add: branches
  25. });
  26. });
  27. $("#browser").bind("contextmenu", function(event) {
  28. if ($(event.target).is("li") || $(event.target).parents("li").length) {
  29. $("#browser").treeview({
  30. remove: $(event.target).parents("li").filter(":first")
  31. });
  32. return false;
  33. }
  34. });
  35. })
  36. </script>
  37. </head>
  38. <body>
  39. <h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-treeview/">jQuery Treeview Plugin</a> Demo</h1>
  40. <div id="main">
  41. <a href=".">Main Demo</a>
  42. <h4>Sample 1 - default, right-click to remove items</h4>
  43. <button id="add">Add!</button>
  44. <ul id="browser" class="filetree">
  45. <li><span class="folder">Folder 1</span>
  46. <ul>
  47. <li><span class="file">Item 1.1</span></li>
  48. </ul>
  49. </li>
  50. <li><span class="folder">Folder 2</span>
  51. <ul>
  52. <li><span class="folder">Subfolder 2.1</span>
  53. <ul id="folder21">
  54. <li><span class="file">File 2.1.1</span></li>
  55. <li><span class="file">File 2.1.2</span></li>
  56. </ul>
  57. </li>
  58. <li><span class="file">File 2.2</span></li>
  59. </ul>
  60. </li>
  61. <li class="closed"><span class="folder">Folder 3 (closed at start)</span>
  62. <ul>
  63. <li><span class="file">File 3.1</span></li>
  64. </ul>
  65. </li>
  66. <li><span class="file">File 4</span></li>
  67. </ul>
  68. </div>
  69. </body></html>