dynamic-options.html 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset='utf-8' />
  5. <link href='../../dist/fullcalendar.css' rel='stylesheet' />
  6. <link href='../../dist/fullcalendar.print.css' rel='stylesheet' media='print' />
  7. <script src='../../node_modules/moment/moment.js'></script>
  8. <script src='../../node_modules/jquery/dist/jquery.js'></script>
  9. <script src='../../dist/fullcalendar.js'></script>
  10. <script>
  11. $(document).ready(function() {
  12. var direction = 'ltr';
  13. var businessHours = false;
  14. $('#change-direction-button').on('click', function() {
  15. direction = direction === 'ltr' ? 'rtl' : 'ltr';
  16. $('#calendar').fullCalendar('option', 'direction', direction);
  17. });
  18. $('#change-businessHours-button').on('click', function() {
  19. businessHours = !businessHours;
  20. $('#calendar').fullCalendar('option', 'businessHours', businessHours);
  21. });
  22. $('#change-all-button').on('click', function() {
  23. direction = direction === 'ltr' ? 'rtl' : 'ltr';
  24. businessHours = !businessHours;
  25. $('#calendar').fullCalendar('option', {
  26. direction: direction,
  27. businessHours: businessHours
  28. });
  29. });
  30. $('#calendar').fullCalendar({
  31. direction: direction,
  32. businessHours: businessHours,
  33. headerToolbar: {
  34. left: 'prev,next today',
  35. center: 'title',
  36. right: 'dayGridMonth,week,day'
  37. },
  38. initialDate: '2014-06-12',
  39. editable: true,
  40. events: [
  41. {
  42. title: 'All Day Event',
  43. start: '2014-06-01'
  44. },
  45. {
  46. title: 'Long Event',
  47. start: '2014-06-07',
  48. end: '2014-06-10'
  49. },
  50. {
  51. groupId: 999,
  52. title: 'Repeating Event',
  53. start: '2014-06-09T16:00:00'
  54. },
  55. {
  56. groupId: 999,
  57. title: 'Repeating Event',
  58. start: '2014-06-16T16:00:00'
  59. },
  60. {
  61. title: 'Meeting',
  62. start: '2014-06-12T10:30:00',
  63. end: '2014-06-12T12:30:00'
  64. },
  65. {
  66. title: 'Lunch',
  67. start: '2014-06-12T12:00:00'
  68. },
  69. {
  70. title: 'Birthday Party',
  71. start: '2014-06-13T07:00:00'
  72. },
  73. {
  74. title: 'Click for Google',
  75. url: 'http://google.com/',
  76. start: '2014-06-28'
  77. }
  78. ]
  79. });
  80. });
  81. </script>
  82. <style>
  83. body {
  84. margin: 0;
  85. padding: 0;
  86. font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
  87. font-size: 14px;
  88. }
  89. #calendar {
  90. width: 900px;
  91. margin: 40px auto;
  92. }
  93. </style>
  94. </head>
  95. <body>
  96. <button id='change-direction-button'>change direction</button>
  97. <button id='change-businessHours-button'>change businessHours</button>
  98. <button id='change-all-button'>change all</button>
  99. <div id='calendar'></div>
  100. </body>
  101. </html>