selectable.html 2.7 KB

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