2
0

selectable.html 2.7 KB

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