day_render.html 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <link href='../../dist/fullcalendar.css' rel='stylesheet' />
  5. <script src='../../node_modules/jquery/dist/jquery.js'></script>
  6. <script src='../../node_modules/moment/moment.js'></script>
  7. <script src='../../dist/fullcalendar.js'></script>
  8. <script>
  9. $(document).ready(function() {
  10. var date = new Date();
  11. var d = date.getDate();
  12. var m = date.getMonth();
  13. var y = date.getFullYear();
  14. $('#calendar').fullCalendar({
  15. dayRender: function(date, td) {
  16. //console.log(date, td);
  17. td.find('.fc-day-content').prepend('this is the ' + date.getDate());
  18. },
  19. dayClick: function(date, allDay) {
  20. console.log(date, allDay);
  21. },
  22. weekNumbers: true,
  23. //selectable: true,
  24. //dir: 'rtl',
  25. header: {
  26. left: 'prev,next today',
  27. center: 'title',
  28. right: 'dayGridMonth,week,dayGridWeek,day,dayGridDay'
  29. },
  30. editable: true,
  31. events: [
  32. {
  33. title: 'All Day Event',
  34. start: new Date(y, m, 1)
  35. },
  36. {
  37. title: 'Long Event',
  38. start: new Date(y, m, d-5),
  39. end: new Date(y, m, d-2)
  40. },
  41. {
  42. groupId: 999,
  43. title: 'Repeating Event',
  44. start: new Date(y, m, d-3, 16, 0),
  45. allDay: false
  46. },
  47. {
  48. groupId: 999,
  49. title: 'Repeating Event',
  50. start: new Date(y, m, d+4, 16, 0),
  51. allDay: false
  52. },
  53. {
  54. title: 'Meeting',
  55. start: new Date(y, m, d, 10, 30),
  56. allDay: false
  57. },
  58. {
  59. title: 'Lunch',
  60. start: new Date(y, m, d, 12, 5),
  61. end: new Date(y, m, d, 14, 43),
  62. allDay: false
  63. },
  64. {
  65. title: 'Birthday Party',
  66. start: new Date(y, m, d+1, 19, 0),
  67. end: new Date(y, m, d+1, 22, 30),
  68. allDay: false
  69. },
  70. {
  71. title: 'Click for Google',
  72. start: new Date(y, m, 28),
  73. end: new Date(y, m, 29),
  74. url: 'http://google.com/'
  75. }
  76. ]
  77. });
  78. });
  79. </script>
  80. <style>
  81. body {
  82. margin-top: 40px;
  83. text-align: center;
  84. font-size: 13px;
  85. font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
  86. }
  87. #calendar {
  88. width: 900px;
  89. margin: 0 auto;
  90. }
  91. </style>
  92. </head>
  93. <body>
  94. <div id='calendar'></div>
  95. </body>
  96. </html>