Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // isOverlapping function taken from http://stackoverflow.com/a/25691209/1057527
- calendar = $('#calendar').fullCalendar({
- // code
- eventDrop: function(event, revertFunc) {
- if (isOverlapping(event)) {
- revertFunc();
- }
- },
- eventResize: function(event, revertFunc) {
- if (isOverlapping(event)) {
- revertFunc();
- }
- },
- // code
- });
- function isOverlapping(event){
- var array = calendar.fullCalendar('clientEvents');
- for(i in array){
- if(array[i]._id != event._id){
- if(!(array[i].start.format() >= event.end.format() || array[i].end.format() <= event.start.format())){
- return true;
- }
- }
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment