selectable.html 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html>
  3. <head>
  4. <link rel='stylesheet' type='text/css' href='../examples/redmond/theme.css' />
  5. <script type='text/javascript' src='loader.js'></script>
  6. <script type='text/javascript'>
  7. var date = new Date();
  8. var d = date.getDate();
  9. var m = date.getMonth();
  10. var y = date.getFullYear();
  11. var calendar;
  12. $(document).ready(function() {
  13. calendar = $('#calendar').fullCalendar({
  14. header: {
  15. left: 'prev,next today',
  16. center: 'title',
  17. right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
  18. },
  19. //defaultView: 'agendaWeek',
  20. //firstDay: 1,
  21. //isRTL: true,
  22. //minTime: 7,
  23. //weekends: false,
  24. //allDaySlot: false,
  25. selectable: true,
  26. /*
  27. selectable: {
  28. month: false,
  29. agenda: true
  30. },
  31. */
  32. selectHelper: true,
  33. /*
  34. selectHelper: function(start, end) {
  35. return $("<div style='background:red' />").text(start+' '+end);
  36. },
  37. */
  38. //unselectAuto: false,
  39. //unselectCancel: '.fc',
  40. select: function(start, end, allDay, ev) {
  41. console.log(
  42. '---- selection ----\n' +
  43. 'start: ' + start + '\n' +
  44. 'end: ' + end + '\n' +
  45. 'allDay: ' + allDay
  46. );
  47. if (ev) {
  48. //console.log('select mouse: ' + ev.pageX + ', ' + ev.pageY);
  49. }
  50. },
  51. unselect: function(ev) {
  52. console.log('unselect');
  53. if (ev) {
  54. //console.log('unselect mouse: ' + ev.pageX + ', ' + ev.pageY);
  55. }
  56. },
  57. dayClick: function(date, allDay) {
  58. console.log('DAYCLICK', date, allDay);
  59. console.log(this);
  60. },
  61. editable: true,
  62. events: [
  63. {
  64. title: 'All Day Event',
  65. start: new Date(y, m, 1)
  66. },
  67. {
  68. title: 'Long Event',
  69. start: new Date(y, m, d-5, 5, 0),
  70. end: new Date(y, m, d-2, 2, 0),
  71. allDay: false
  72. },
  73. {
  74. id: 999,
  75. title: 'Repeating Event',
  76. start: new Date(y, m, d-3, 16, 0),
  77. allDay: false
  78. },
  79. {
  80. id: 999,
  81. title: 'Repeating Event',
  82. start: new Date(y, m, d+4, 16, 0),
  83. allDay: false
  84. },
  85. {
  86. title: 'Meeting',
  87. start: new Date(y, m, d, 10, 30),
  88. allDay: false
  89. },
  90. {
  91. title: 'Lunch',
  92. start: new Date(y, m, d, 12, 5),
  93. end: new Date(y, m, d, 14, 43),
  94. allDay: false
  95. },
  96. {
  97. title: 'Birthday Party',
  98. start: new Date(y, m, d+1, 19, 0),
  99. end: new Date(y, m, d+1, 22, 30),
  100. allDay: false
  101. },
  102. {
  103. title: 'Click for Google',
  104. start: new Date(y, m, 28),
  105. end: new Date(y, m, 29),
  106. url: 'http://google.com/'
  107. }
  108. ]
  109. });
  110. });
  111. </script>
  112. <style type='text/css'>
  113. body {
  114. font-size: 13px;
  115. font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
  116. }
  117. #calendar {
  118. width: 900px;
  119. margin: 40px auto;
  120. }
  121. </style>
  122. </head>
  123. <body>
  124. <button onclick="calendar.fullCalendar('select', new Date(y, m, d-1), new Date(y, m, d-1), true)">1day, allday</button>
  125. <button onclick="calendar.fullCalendar('select', new Date(y, m, d-1))">1day, noend, noallday</button>
  126. <button onclick="calendar.fullCalendar('select', new Date(y, m, d-1), null, false)">1day, noend, allday=false</button>
  127. <button onclick="calendar.fullCalendar('select', new Date(y, m, d, 5, 15), new Date(y, m, d, 15, 30), false)">1day, timed</button>
  128. <button onclick="calendar.fullCalendar('select', new Date(y, m, d-2), new Date(y, m, d), true)">3day, allday</button>
  129. <button onclick="calendar.fullCalendar('select', new Date(y, m, d-1, 5, 15), new Date(y, m, d+1, 15, 30), false)">3day, timed</button>
  130. <button onclick="calendar.fullCalendar('unselect')">unselect</button>
  131. <div id='calendar'></div>
  132. </body>
  133. </html>