selectable.html 2.2 KB

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