FullCalendar plugin 3.1.0 is not displayed correctly

2

I can not get FullCalendar to be displayed correctly in my blade template of Laravel , I do not know what I'm doing wrong. The result I get is the following:

It is supposed to look like this:

I'm using Laravel 5.3 , jQuery 2.2.3 and Xampp . The strange thing is that when executing the demos of FullCalendar they are displayed correctly, but when I pass it to a template blade it is no longer displayed the same. The CSS and JS files are loaded correctly, and the debug console does not show any errors. The code of the blade template is as follows:

$(document).ready(function() {

	$('#calendar').fullCalendar({
		defaultDate: '2016-12-12',
		editable: true,
		eventLimit: true, // allow "more" link when too many events
		events: [
			{
				title: 'All Day Event',
				start: '2016-12-01'
			},
			{
				title: 'Long Event',
				start: '2016-12-07',
				end: '2016-12-10'
			},
			{
				id: 999,
				title: 'Repeating Event',
				start: '2016-12-09T16:00:00'
			},
			{
				id: 999,
				title: 'Repeating Event',
				start: '2016-12-16T16:00:00'
			},
			{
				title: 'Conference',
				start: '2016-12-11',
				end: '2016-12-13'
			},
			{
				title: 'Meeting',
				start: '2016-12-12T10:30:00',
				end: '2016-12-12T12:30:00'
			},
			{
				title: 'Lunch',
				start: '2016-12-12T12:00:00'
			},
			{
				title: 'Meeting',
				start: '2016-12-12T14:30:00'
			},
			{
				title: 'Happy Hour',
				start: '2016-12-12T17:30:00'
			},
			{
				title: 'Dinner',
				start: '2016-12-12T20:00:00'
			},
			{
				title: 'Birthday Party',
				start: '2016-12-13T07:00:00'
			},
			{
				title: 'Click for Google',
				url: 'http://google.com/',
				start: '2016-12-28'
			}
		]
    });
});
body {
	margin: 40px 10px;
	padding: 0;
	font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
	font-size: 14px;
}

#calendar {
	max-width: 900px;
	margin: 0 auto;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<link href="http://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/fullcalendar.min.css" rel="stylesheet" type="text/css" />
<link href="http://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/fullcalendar.print.css" rel="stylesheet" type="text/css" />

<script src="http://momentjs.com/downloads/moment-with-locales.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/fullcalendar.min.js"></script>
</head>
	<body>
		<div id='calendar'></div>
	</body>
</html>
    
asked by score 21.12.2016 в 01:47
source

1 answer

1

It is only a matter of eliminating the call to fullcalendar.print.css removing that line is displayed correctly.

The library fullcalendar.print.css what it does is show the hidden content to be able to print it, if this is the case you need to print the calendar you can do:

  • Load the library fullcalendar.print.css by javascript or jquery when you press a button and then remove that library.
  • Load a different page with styles loaded from fullcalendar.print.css and print from that page (automatic action)
  • Your code running without the fullcalendar.print.css library:

    $(document).ready(function() {
    
    	$('#calendar').fullCalendar({
    		defaultDate: '2016-12-12',
    		editable: true,
    		eventLimit: true, // allow "more" link when too many events
    		events: [
    			{
    				title: 'All Day Event',
    				start: '2016-12-01'
    			},
    			{
    				title: 'Long Event',
    				start: '2016-12-07',
    				end: '2016-12-10'
    			},
    			{
    				id: 999,
    				title: 'Repeating Event',
    				start: '2016-12-09T16:00:00'
    			},
    			{
    				id: 999,
    				title: 'Repeating Event',
    				start: '2016-12-16T16:00:00'
    			},
    			{
    				title: 'Conference',
    				start: '2016-12-11',
    				end: '2016-12-13'
    			},
    			{
    				title: 'Meeting',
    				start: '2016-12-12T10:30:00',
    				end: '2016-12-12T12:30:00'
    			},
    			{
    				title: 'Lunch',
    				start: '2016-12-12T12:00:00'
    			},
    			{
    				title: 'Meeting',
    				start: '2016-12-12T14:30:00'
    			},
    			{
    				title: 'Happy Hour',
    				start: '2016-12-12T17:30:00'
    			},
    			{
    				title: 'Dinner',
    				start: '2016-12-12T20:00:00'
    			},
    			{
    				title: 'Birthday Party',
    				start: '2016-12-13T07:00:00'
    			},
    			{
    				title: 'Click for Google',
    				url: 'http://google.com/',
    				start: '2016-12-28'
    			}
    		]
        });
    });
    body {
    	margin: 40px 10px;
    	padding: 0;
    	font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
    	font-size: 14px;
    }
    
    #calendar {
    	max-width: 900px;
    	margin: 0 auto;
    }
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset='utf-8' />
    <link href="http://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/fullcalendar.min.css" rel="stylesheet" type="text/css" />
    
    <script src="http://momentjs.com/downloads/moment-with-locales.js"></script>
    <script src="http://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/fullcalendar.min.js"></script>
    </head>
    	<body>
    		<div id='calendar'></div>
    	</body>
    </html>
        
    answered by 01.03.2017 в 16:47