droppable.html 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <link href='../build/out/fullcalendar.css' rel='stylesheet' />
  5. <link href='../build/out/fullcalendar.print.css' rel='stylesheet' media='print' />
  6. <script src='../build/out/jquery.js'></script>
  7. <script src='../build/out/jquery-ui.js'></script>
  8. <script src='../build/out/fullcalendar.js'></script>
  9. <script>
  10. $(document).ready(function() {
  11. var date = new Date();
  12. var d = date.getDate();
  13. var m = date.getMonth();
  14. var y = date.getFullYear();
  15. $('#calendar').fullCalendar({
  16. editable: true,
  17. droppable: true,
  18. drop: function(date, allDay, ev) {
  19. console.log('drop', date, allDay, ev);
  20. },
  21. //defaultView: 'agendaWeek',
  22. //firstDay: 1,
  23. //hiddenDays: [ 4, 6 ], // hide thursday and saturday
  24. //isRTL: true,
  25. //minTime: '6:30am',
  26. header: {
  27. left: 'prev,next today',
  28. center: 'title',
  29. right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
  30. },
  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. id: 999,
  43. title: 'Repeating Event',
  44. start: new Date(y, m, d-3, 16, 0),
  45. allDay: false
  46. },
  47. {
  48. id: 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. $('.external-event').draggable({
  79. revert: true,
  80. revertDuration: 0,
  81. zIndex: 999
  82. });
  83. $('#calendar2').fullCalendar({
  84. //isRTL: true,
  85. droppable: true,
  86. dropAccept: '.for-calendar2',
  87. /*
  88. dropAccept: function(e) {
  89. console.log(e);
  90. console.log(this);
  91. return e.text() == 'Draggable 1';
  92. },
  93. */
  94. drop: function(date, allDay) {
  95. console.log('drop 2nd calendar', date, allDay);
  96. },
  97. header: {
  98. left: 'prev,next today',
  99. center: 'title',
  100. right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
  101. }
  102. });
  103. });
  104. </script>
  105. <style>
  106. body {
  107. margin-top: 40px;
  108. text-align: center;
  109. font-size: 13px;
  110. font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
  111. }
  112. #calendar {
  113. width: 900px;
  114. float: left;
  115. }
  116. #external-events {
  117. position: relative;
  118. left: 50px;
  119. text-align: left;
  120. float: left;
  121. width: 140px;
  122. padding: 10px;
  123. border: 1px solid #aaa;
  124. background: #ccc;
  125. }
  126. .external-event {
  127. height: 20px;
  128. line-height: 20px;
  129. color: #fff;
  130. background: blue;
  131. margin-bottom: 10px;
  132. padding-left: 5px;
  133. cursor: pointer;
  134. }
  135. #calendar2 {
  136. width: 900px;
  137. margin-top: 50px;
  138. }
  139. </style>
  140. </head>
  141. <body>
  142. <div id='calendar'></div>
  143. <div id='external-events'>
  144. <div class='external-event'>Draggable 1</div>
  145. <div class='external-event'>Draggable 2</div>
  146. <div class='external-event for-calendar2'>Draggable 3</div>
  147. </div>
  148. <div style='clear:both'></div>
  149. <div id='calendar2'></div>
  150. </body>
  151. </html>