droppable.html 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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. //isRTL: true,
  24. //minTime: '6:30am',
  25. header: {
  26. left: 'prev,next today',
  27. center: 'title',
  28. right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
  29. },
  30. events: [
  31. {
  32. title: 'All Day Event',
  33. start: new Date(y, m, 1)
  34. },
  35. {
  36. title: 'Long Event',
  37. start: new Date(y, m, d-5),
  38. end: new Date(y, m, d-2)
  39. },
  40. {
  41. id: 999,
  42. title: 'Repeating Event',
  43. start: new Date(y, m, d-3, 16, 0),
  44. allDay: false
  45. },
  46. {
  47. id: 999,
  48. title: 'Repeating Event',
  49. start: new Date(y, m, d+4, 16, 0),
  50. allDay: false
  51. },
  52. {
  53. title: 'Meeting',
  54. start: new Date(y, m, d, 10, 30),
  55. allDay: false
  56. },
  57. {
  58. title: 'Lunch',
  59. start: new Date(y, m, d, 12, 5),
  60. end: new Date(y, m, d, 14, 43),
  61. allDay: false
  62. },
  63. {
  64. title: 'Birthday Party',
  65. start: new Date(y, m, d+1, 19, 0),
  66. end: new Date(y, m, d+1, 22, 30),
  67. allDay: false
  68. },
  69. {
  70. title: 'Click for Google',
  71. start: new Date(y, m, 28),
  72. end: new Date(y, m, 29),
  73. url: 'http://google.com/'
  74. }
  75. ]
  76. });
  77. $('.external-event').draggable({
  78. revert: true,
  79. revertDuration: 0,
  80. zIndex: 999
  81. });
  82. $('#calendar2').fullCalendar({
  83. //isRTL: true,
  84. droppable: true,
  85. dropAccept: '.for-calendar2',
  86. /*
  87. dropAccept: function(e) {
  88. console.log(e);
  89. console.log(this);
  90. return e.text() == 'Draggable 1';
  91. },
  92. */
  93. drop: function(date, allDay) {
  94. console.log('drop 2nd calendar', date, allDay);
  95. },
  96. header: {
  97. left: 'prev,next today',
  98. center: 'title',
  99. right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
  100. }
  101. });
  102. });
  103. </script>
  104. <style>
  105. body {
  106. margin-top: 40px;
  107. text-align: center;
  108. font-size: 13px;
  109. font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
  110. }
  111. #calendar {
  112. width: 900px;
  113. float: left;
  114. }
  115. #external-events {
  116. position: relative;
  117. left: 50px;
  118. text-align: left;
  119. float: left;
  120. width: 140px;
  121. padding: 10px;
  122. border: 1px solid #aaa;
  123. background: #ccc;
  124. }
  125. .external-event {
  126. height: 20px;
  127. line-height: 20px;
  128. color: #fff;
  129. background: blue;
  130. margin-bottom: 10px;
  131. padding-left: 5px;
  132. cursor: pointer;
  133. }
  134. #calendar2 {
  135. width: 900px;
  136. margin-top: 50px;
  137. }
  138. </style>
  139. </head>
  140. <body>
  141. <div id='calendar'></div>
  142. <div id='external-events'>
  143. <div class='external-event'>Draggable 1</div>
  144. <div class='external-event'>Draggable 2</div>
  145. <div class='external-event for-calendar2'>Draggable 3</div>
  146. </div>
  147. <div style='clear:both'></div>
  148. <div id='calendar2'></div>
  149. </body>
  150. </html>