vis.js is a dynamic, browser-based visualization library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.4 KiB

  1. <html>
  2. <head>
  3. <title>Timeline | itemsAlwaysDraggable Option</title>
  4. <meta charset="utf-8">
  5. <script src="../../../dist/vis.js"></script>
  6. <link href="../../../dist/vis-timeline-graph2d.min.css" rel="stylesheet" type="text/css" />
  7. </head>
  8. <body>
  9. <p>The <code>itemsAlwaysDraggable</code> option allows to drag items around without first selecting them. When <code>itemsAlwaysDraggable.range</code> is set to <code>true</code>, the range can be changed without selection as well.</p>
  10. <div id="mytimeline"></div>
  11. <script>
  12. var container = document.getElementById('mytimeline'),
  13. items = new vis.DataSet();
  14. for (var i = 10; i >= 0; i--) {
  15. var start = new Date(new Date().getTime() + i * 100000);
  16. items.add({
  17. id: i,
  18. content: "item " + i,
  19. start: start,
  20. end: new Date(start.getTime() + 100000)
  21. });
  22. }
  23. var options = {
  24. start: new Date(),
  25. end: new Date(new Date().getTime() + 1000000),
  26. editable: true,
  27. itemsAlwaysDraggable: {
  28. item: true,
  29. range: true
  30. }
  31. };
  32. var timeline = new vis.Timeline(container, items, null, options);
  33. </script>
  34. </body>
  35. </html>