title: FullCalendar - Change View for Mobile Devices
body: <p>Using the <code>FullCalendar</code> plugin - I am trying to change the view, for mobile devices to <code>"basicDay"</code>, but on desktops I still want the view to remain as "basicWeek".</p>
  
  <p>I am a JS newbie, and have tried various different <code>if/elseif</code> statements with <code>JS</code> and <code>PHP</code>, but I cannot get the calendar to display correctly for mobile devices.</p>
  
  <p>You will see my code below that I am using the argument <code>"windowResize"</code> - which works perfectly! Only when the window is resized, however when the calendar is loaded fresh from a mobile device the view is still "basicWeek".</p>
  
  <p>I have tried various statements to solve this issue with no luck, example:</p>
  
  <pre><code>if( $(window).width() &lt; 765 ) {
         &lt;?php $view = 'basicDay'; ?&gt;
  } else {
         &lt;?php $view = 'basicWeek' ?&gt;
  }
  </code></pre>
  
  <p>and then echoing the value with <code>PHP</code> (obviously doesn't work), and have tried other <code>if/elseif</code> statements with <code>JS</code>.
  Here is my fullCalendar code below:</p>
  
  <pre><code>$('#calendar').fullCalendar({
             header: {
                        left: 'prev,next today',
                        center: 'title',
                     },
             titleFormat:'MMMM D YYYY',
             hiddenDays: [0],
             columnFormat: 'dddd',
             defaultView: &lt;?php echo "'" . $view . "'" ?&gt;,
  
             // responsive
             windowResize: function(view) {
                 if ($(window).width() &lt; 765){
                      $('#calendar').fullCalendar( 'changeView', 'basicDay' );
                  } else {
                      $('#calendar').fullCalendar( 'changeView', 'basicWeek' );
                  }
             },
             timeFormat: 'hh:mm A',
  });
  </code></pre>
  
  <p>So just to confirm, how can I have my calendar remain in basicWeek for desktops, but show as basicDay for mobile sized devices?</p>
  
  <p>Thank-you in advance.</p>