Mobile Default View
-
Since the calendar doesn’t scale very well for small mobile screens, I was wondering if there might be a hook or trigger to use with jQuery in order to set a default view.
So for screen sizes 768px to 1030px I wanted the calendar to display in “week” view and then for under 768px I wanted it to display in “day” view.
Anyway, I got this to work with some crude jQuery and thought I might leave this here for anyone to grab it if they need it:
jQuery(document).ready(function($) { var calWindowWidth = jQuery(window).width(); if (calWindowWidth <= 1030 && calWindowWidth >= 768) { jQuery('.wpfc-calendar').fullCalendar( 'changeView', 'basicWeek' ); } else if (calWindowWidth <= 767) { jQuery('.wpfc-calendar').fullCalendar( 'changeView', 'basicDay' ); } else { jQuery('.wpfc-calendar').fullCalendar( 'changeView', 'month' ); } jQuery(window).resize(function() { var calResizeWidth = jQuery(window).width(); if (calResizeWidth <= 1030 && calResizeWidth >= 768) { jQuery('.wpfc-calendar').fullCalendar( 'changeView', 'basicWeek' ); } else if (calResizeWidth <= 767 ) { jQuery('.wpfc-calendar').fullCalendar( 'changeView', 'basicDay' ); } else { jQuery('.wpfc-calendar').fullCalendar( 'changeView', 'month' ); } }); }); /* end of as page load scripts */
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Mobile Default View’ is closed to new replies.