1_basic.html 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <title>jsMind</title>
  7. <link type="text/css" rel="stylesheet" href="../style/jsmind.css" />
  8. <style type="text/css">
  9. #jsmind_container{
  10. width:800px;
  11. height:500px;
  12. border:solid 1px #ccc;
  13. /*background:#f4f4f4;*/
  14. background:#f4f4f4;
  15. }
  16. </style>
  17. </head>
  18. <body>
  19. <div id="jsmind_container"></div>
  20. <script type="text/javascript" src="../js/jsmind.js"></script>
  21. <script type="text/javascript" src="../js/jsmind.draggable.js"></script>
  22. <script type="text/javascript">
  23. function load_jsmind(){
  24. var mind = {
  25. "meta":{
  26. "name":"demo",
  27. "author":"hizzgdev@163.com",
  28. "version":"0.2",
  29. },
  30. "format":"node_array",
  31. "data":[
  32. {"id":"root", "isroot":true, "topic":"jsMind"},
  33. {"id":"sub1", "parentid":"root", "topic":"sub1", "background-color":"#0000ff"},
  34. {"id":"sub11", "parentid":"sub1", "topic":"sub11"},
  35. {"id":"sub12", "parentid":"sub1", "topic":"sub12"},
  36. {"id":"sub13", "parentid":"sub1", "topic":"sub13"},
  37. {"id":"sub2", "parentid":"root", "topic":"sub2"},
  38. {"id":"sub21", "parentid":"sub2", "topic":"sub21"},
  39. {"id":"sub22", "parentid":"sub2", "topic":"sub22","foreground-color":"#33ff33"},
  40. {"id":"sub3", "parentid":"root", "topic":"sub3"},
  41. ]
  42. };
  43. var options = {
  44. container:'jsmind_container',
  45. editable:true,
  46. theme:'primary'
  47. }
  48. var jm = jsMind.show(options,mind);
  49. // jm.set_readonly(true);
  50. // var mind_data = jm.get_data();
  51. // alert(mind_data);
  52. jm.add_node("sub2","sub23", "new node", {"background-color":"red"});
  53. jm.set_node_color('sub21', 'green', '#ccc');
  54. }
  55. load_jsmind();
  56. </script>
  57. </body>
  58. </html>