Skip to content

Commit

Permalink
feat: ✨ make initial view dependent on window width
Browse files Browse the repository at this point in the history
  • Loading branch information
neptunes5thmoon committed Jun 1, 2024
1 parent 1cd1470 commit 4d37c2b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion assets/js/calendar.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
document.addEventListener('DOMContentLoaded', function () {
var calendarEl = document.getElementById('calendar');
function getInitialView() {
if (window.innerWidth < 768) {
return 'listWeek';
} else {
return 'timeGridWeek';
}
}
var calendar = new FullCalendar.Calendar(calendarEl, {
timeZone: 'America/New_York',
initialView: 'timeGridWeek',
initialView: getInitialView(),
initialDate: '2024-08-21',
contentHeight: 'auto',
slotMinTime: '08:00:00',
Expand Down

0 comments on commit 4d37c2b

Please sign in to comment.