Forked from juanbrujo/fullCalendarDisablePrevNext.js
Created
February 9, 2018 05:50
-
-
Save JefMari/beda3f962de2970a13e9c249cd1e85c8 to your computer and use it in GitHub Desktop.
jQuery FullCalendar.js: disable prev/next button for past/future dates
This file contains hidden or 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
| $('#calendar').fullCalendar({ | |
| viewRender: function(currentView){ | |
| var minDate = moment(), | |
| maxDate = moment().add(2,'weeks'); | |
| // Past | |
| if (minDate >= currentView.start && minDate <= currentView.end) { | |
| $(".fc-prev-button").prop('disabled', true); | |
| $(".fc-prev-button").addClass('fc-state-disabled'); | |
| } | |
| else { | |
| $(".fc-prev-button").removeClass('fc-state-disabled'); | |
| $(".fc-prev-button").prop('disabled', false); | |
| } | |
| // Future | |
| if (maxDate >= currentView.start && maxDate <= currentView.end) { | |
| $(".fc-next-button").prop('disabled', true); | |
| $(".fc-next-button").addClass('fc-state-disabled'); | |
| } else { | |
| $(".fc-next-button").removeClass('fc-state-disabled'); | |
| $(".fc-next-button").prop('disabled', false); | |
| } | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment