selectable.html 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset='utf-8' />
  5. <link href='../packages/bundle/dist/main.css' rel='stylesheet' />
  6. <script src='../packages/bundle/dist/main.js'></script>
  7. <script>
  8. document.addEventListener('DOMContentLoaded', function() {
  9. var calendarEl = document.getElementById('calendar');
  10. var calendar = new FullCalendar.Calendar(calendarEl, {
  11. header: {
  12. left: 'prev,next today',
  13. center: 'title',
  14. right: 'dayGridMonth,timeGridWeek,timeGridDay'
  15. },
  16. defaultDate: '2020-02-12',
  17. navLinks: true, // can click day/week names to navigate views
  18. selectable: true,
  19. selectMirror: true,
  20. select: function(arg) {
  21. var title = prompt('Event Title:');
  22. if (title) {
  23. calendar.addEvent({
  24. title: title,
  25. start: arg.start,
  26. end: arg.end,
  27. allDay: arg.allDay
  28. })
  29. }
  30. calendar.unselect()
  31. },
  32. editable: true,
  33. eventLimit: true, // allow "more" link when too many events
  34. events: [
  35. {
  36. title: 'All Day Event',
  37. start: '2020-02-01'
  38. },
  39. {
  40. title: 'Long Event',
  41. start: '2020-02-07',
  42. end: '2020-02-10'
  43. },
  44. {
  45. groupId: 999,
  46. title: 'Repeating Event',
  47. start: '2020-02-09T16:00:00'
  48. },
  49. {
  50. groupId: 999,
  51. title: 'Repeating Event',
  52. start: '2020-02-16T16:00:00'
  53. },
  54. {
  55. title: 'Conference',
  56. start: '2020-02-11',
  57. end: '2020-02-13'
  58. },
  59. {
  60. title: 'Meeting',
  61. start: '2020-02-12T10:30:00',
  62. end: '2020-02-12T12:30:00'
  63. },
  64. {
  65. title: 'Lunch',
  66. start: '2020-02-12T12:00:00'
  67. },
  68. {
  69. title: 'Meeting',
  70. start: '2020-02-12T14:30:00'
  71. },
  72. {
  73. title: 'Happy Hour',
  74. start: '2020-02-12T17:30:00'
  75. },
  76. {
  77. title: 'Dinner',
  78. start: '2020-02-12T20:00:00'
  79. },
  80. {
  81. title: 'Birthday Party',
  82. start: '2020-02-13T07:00:00'
  83. },
  84. {
  85. title: 'Click for Google',
  86. url: 'http://google.com/',
  87. start: '2020-02-28'
  88. }
  89. ]
  90. });
  91. calendar.render();
  92. });
  93. </script>
  94. <style>
  95. body {
  96. margin: 40px 10px;
  97. padding: 0;
  98. font-family: Arial, Helvetica Neue, Helvetica, sans-serif;
  99. font-size: 14px;
  100. }
  101. #calendar {
  102. max-width: 900px;
  103. margin: 0 auto;
  104. }
  105. </style>
  106. </head>
  107. <body>
  108. <div id='calendar'></div>
  109. </body>
  110. </html>