Project Structure:
demo.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>FullCalendar</title>
<link href='fullcalendar.css' rel='stylesheet' />
<link href='fullcalendar.print.css' rel='stylesheet' media='print' />
<script src='lib/jquery.min.js'></script>
<script src='lib/moment.min.js'></script>
<script src='fullcalendar.min.js'></script>
<script src='lang-all.js'></script>
<script src='common.js'></script>
<style type="text/css">
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;
}
</style>
</head>
<body>
<div id='calendar'></div>
</body>
</html>
common.js
$(document).ready(function() {
$('#calendar').fullCalendar({
defaultDate:$.now(),
// lang: 'ja',
editable: true,
eventLimit: true,
customButtons: {
btnJan: {
text: 'January',
click: function() {
var moment = $('#calendar').fullCalendar('getDate');
var currentMonth = moment.format('YYYY')+'-'+01+'-'+01;
$('#calendar').fullCalendar('gotoDate', currentMonth);
}
},
btnFeb: {
text: 'February',
click: function() {
var moment = $('#calendar').fullCalendar('getDate');
var currentMonth = moment.format('YYYY')+'-'+02+'-'+01;
$('#calendar').fullCalendar('gotoDate', currentMonth);
}
}
},
header: {
left: 'prev,next today btnJan btnFeb',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
dayNamesShort: ['Sunday', 'Monday', 'Tuesday', 'Wednesday','Thursday', 'Friday', 'Saturday'],
monthNames:['January', 'February', 'March', 'April', 'May', 'June', 'July','August', 'September', 'October', 'November', 'December'],
titleFormat:'MMMM D YYYY',
events: [
{
title: 'All Day Event',
start: '2016-06-01'
}
]
});
});
Output:
0 comments:
Post a Comment