Debian Codegraph @

tests/manual/old/external-dragging-touch-punch.html

raw
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='../../node_modules/components-jqueryui/jquery-ui.js'></script>
10 <script src='../../dist/fullcalendar.js'></script>
11 <script src='https://cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js'></script>
12 <script>
13
14 $(document).ready(function() {
15
16
17 /* initialize the external events
18 -----------------------------------------------------------------*/
19
20 $('#external-events .fc-event').each(function() {
21
22 // store data so the calendar knows to render an event upon drop
23 $(this).data('event', {
24 title: $.trim($(this).text()), // use the element's text as the event title
25 stick: true // maintain when user navigates (see docs on the renderEvent method)
26 });
27
28 // make the event draggable using jQuery UI
29 $(this).draggable({
30 zIndex: 999,
31 revert: true, // will cause the event to go back to its
32 revertDuration: 0 // original position after the drag
33 });
34
35 });
36
37
38 /* initialize the calendar
39 -----------------------------------------------------------------*/
40
41 $('#calendar').fullCalendar({
42 headerToolbar: {
43 left: 'prev,next today',
44 center: 'title',
45 right: 'dayGridMonth,week,day'
46 },
47 editable: true,
48 droppable: true, // this allows things to be dropped onto the calendar
49 drop: function() {
50 // is the "remove after drop" checkbox checked?
51 if ($('#drop-remove').is(':checked')) {
52 // if so, remove the element from the "Draggable Events" list
53 $(this).remove();
54 }
55 }
56 });
57
58
59 });
60
61 </script>
62 <style>
63
64 body {
65 margin-top: 40px;
66 text-align: center;
67 font-size: 14px;
68 font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
69 }
70
71 #wrap {
72 width: 1100px;
73 margin: 0 auto;
74 }
75
76 #external-events {
77 float: left;
78 width: 150px;
79 padding: 0 10px;
80 border: 1px solid #ccc;
81 background: #eee;
82 text-align: left;
83 }
84
85 #external-events h4 {
86 font-size: 16px;
87 margin-top: 0;
88 padding-top: 1em;
89 }
90
91 #external-events .fc-event {
92 margin: 10px 0;
93 cursor: pointer;
94 }
95
96 #external-events p {
97 margin: 1.5em 0;
98 font-size: 11px;
99 color: #666;
100 }
101
102 #external-events p input {
103 margin: 0;
104 vertical-align: middle;
105 }
106
107 #calendar {
108 float: right;
109 width: 900px;
110 }
111
112 </style>
113 </head>
114 <body>
115 <div id='wrap'>
116
117 <div id='external-events'>
118 <h4>Draggable Events</h4>
119 <div class='fc-event'>My Event 1</div>
120 <div class='fc-event'>My Event 2</div>
121 <div class='fc-event'>My Event 3</div>
122 <div class='fc-event'>My Event 4</div>
123 <div class='fc-event'>My Event 5</div>
124 <p>
125 <input type='checkbox' id='drop-remove' />
126 <label for='drop-remove'>remove after drop</label>
127 </p>
128 </div>
129
130 <div id='calendar'></div>
131
132 <div style='clear:both'></div>
133
134 </div>
135 </body>
136 </html>