Created
January 28, 2017 11:59
-
-
Save mssoylu/26ef7912595da7648ef677c246111945 to your computer and use it in GitHub Desktop.
use a resize limit for new events in fullcalendar options
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select:function (start, end) { | |
var mEnd = $.fullCalendar.moment(end); | |
var mStart = $.fullCalendar.moment(start); | |
slotParts = calendar.fullCalendar('option','slotDuration').split(':'); | |
var addDurationToStart = moment(mStart).add(slotParts[0], 'hours').add(slotParts[1],'minutes'); | |
if (mEnd.isAfter(addDurationToStart)) { | |
calendar.fullCalendar('unselect'); | |
} else { | |
calendar.fullCalendar('renderEvent', { | |
start: mStart, | |
end: mEnd, | |
allDay: false | |
}, | |
true | |
); | |
calendar.fullCalendar('unselect'); | |
} | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment