graph2.html 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>Graph example</title>
  5. <meta http-equiv="content-type" content="text/html;charset=utf-8" />
  6. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
  7. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js"></script>
  8. <script type="text/javascript" src="http://jsplumb.org/js/1.3.1/jquery.jsPlumb-1.3.1-all-min.js"></script>
  9. <style>
  10. .node {
  11. position: absolute;
  12. height: 50px;
  13. width: 50px;
  14. line-height: 50px;
  15. -moz-border-radius: 30px;
  16. border-radius: 30px;
  17. background-color: black;
  18. color: white;
  19. text-align: center;
  20. font-size: 2em;
  21. }
  22. </style>
  23. </head>
  24. <body >
  25. <div class="node" id="b1" style="top:100px;left:300px">1</div>
  26. <div class="node" id="b2" style="top:200px;left:500px;">2</div>
  27. <div class="node" id="b3" style="top:400px;left:400px;">3</div>
  28. <div class="node" id="b4" style="top:400px;left:200px;">4</div>
  29. <div class="node" id="b5" style="top:200px;left:100px;">5</div>
  30. <script type="text/javascript">
  31. jsPlumb.bind("ready", function() {
  32. jsPlumb.draggable('b1');
  33. jsPlumb.draggable('b2');
  34. jsPlumb.draggable('b3');
  35. jsPlumb.draggable('b4');
  36. jsPlumb.draggable('b5');
  37. jsPlumb.connect({source:"b1", target:"b2"});
  38. jsPlumb.connect({source:"b2", target:"b3"});
  39. jsPlumb.connect({source:"b3", target:"b4"});
  40. jsPlumb.connect({source:"b1", target:"b3"});
  41. });
  42. </script>
  43. </body>
  44. </html>