timeline-background-events.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset='utf-8' />
  5. <link href='../packages-premium/bundle/main.css' rel='stylesheet' />
  6. <script src='../packages-premium/bundle/main.js'></script>
  7. <script>
  8. document.addEventListener('DOMContentLoaded', function() {
  9. var calendarEl = document.getElementById('calendar');
  10. var calendar = new FullCalendar.Calendar(calendarEl, {
  11. now: '2020-09-07',
  12. editable: true, // enable draggable events
  13. aspectRatio: 1.8,
  14. scrollTime: '00:00', // undo default 6am scrollTime
  15. headerToolbar: {
  16. left: 'today prev,next',
  17. center: 'title',
  18. right: 'resourceTimelineDay,resourceTimelineThreeDays,timeGridWeek,dayGridMonth'
  19. },
  20. initialView: 'resourceTimelineDay',
  21. views: {
  22. resourceTimelineThreeDays: {
  23. type: 'resourceTimeline',
  24. duration: { days: 3 },
  25. buttonText: '3 days'
  26. }
  27. },
  28. resourceAreaHeaderContent: 'Rooms',
  29. resources: [
  30. { id: 'a', title: 'Auditorium A' },
  31. { id: 'b', title: 'Auditorium B', eventColor: 'green' },
  32. { id: 'c', title: 'Auditorium C', eventColor: 'orange' },
  33. { id: 'd', title: 'Auditorium D', children: [
  34. { id: 'd1', title: 'Room D1' },
  35. { id: 'd2', title: 'Room D2' }
  36. ] },
  37. { id: 'e', title: 'Auditorium E' },
  38. { id: 'f', title: 'Auditorium F', eventColor: 'red' },
  39. { id: 'g', title: 'Auditorium G' },
  40. { id: 'h', title: 'Auditorium H' },
  41. { id: 'i', title: 'Auditorium I' },
  42. { id: 'j', title: 'Auditorium J' },
  43. { id: 'k', title: 'Auditorium K' },
  44. { id: 'l', title: 'Auditorium L' },
  45. { id: 'm', title: 'Auditorium M' },
  46. { id: 'n', title: 'Auditorium N' },
  47. { id: 'o', title: 'Auditorium O' },
  48. { id: 'p', title: 'Auditorium P' },
  49. { id: 'q', title: 'Auditorium Q' },
  50. { id: 'r', title: 'Auditorium R' },
  51. { id: 's', title: 'Auditorium S' },
  52. { id: 't', title: 'Auditorium T' },
  53. { id: 'u', title: 'Auditorium U' },
  54. { id: 'v', title: 'Auditorium V' },
  55. { id: 'w', title: 'Auditorium W' },
  56. { id: 'x', title: 'Auditorium X' },
  57. { id: 'y', title: 'Auditorium Y' },
  58. { id: 'z', title: 'Auditorium Z' }
  59. ],
  60. events: [
  61. // background event, associated with a resource
  62. { id: 'bg1', resourceId: 'b', display: 'background', start: '2020-09-07T01:00:00', end: '2020-09-07T04:00:00' },
  63. // background event, NOT associated with a resource
  64. { id: 'bg2', display: 'background', start: '2020-09-07T05:00:00', end: '2020-09-07T08:00:00' },
  65. // normal events...
  66. { id: '1', resourceId: 'b', start: '2020-09-07T02:00:00', end: '2020-09-07T07:00:00', title: 'event 1' },
  67. { id: '2', resourceId: 'c', start: '2020-09-07T05:00:00', end: '2020-09-07T22:00:00', title: 'event 2' },
  68. { id: '3', resourceId: 'd', start: '2020-09-06', end: '2020-09-09', title: 'event 3' },
  69. { id: '4', resourceId: 'e', start: '2020-09-07T03:00:00', end: '2020-09-07T08:00:00', title: 'event 4' },
  70. { id: '5', resourceId: 'f', start: '2020-09-07T00:30:00', end: '2020-09-07T02:30:00', title: 'event 5' }
  71. ]
  72. });
  73. calendar.render();
  74. });
  75. </script>
  76. <style>
  77. body {
  78. margin: 0;
  79. padding: 0;
  80. font-family: Arial, Helvetica Neue, Helvetica, sans-serif;
  81. font-size: 14px;
  82. }
  83. #calendar {
  84. max-width: 1100px;
  85. margin: 50px auto;
  86. }
  87. </style>
  88. </head>
  89. <body>
  90. <div id='calendar'></div>
  91. </body>
  92. </html>