[英]How to customize fullcalendar, a javascript event calendar?
I am new to javascript and web developing.我是 javascript 和 web 开发的新手。
So, I used the fullcalendar library ( https://fullcalendar.io/ ) to make a calendar view, and I wonder if I am able to customize it myself.所以,我使用 fullcalendar 库( https://fullcalendar.io/ )来制作日历视图,我想知道我是否能够自己自定义它。
This is my Markup code:这是我的标记代码:
<div id="blueBackground">
<div class="container">
<div id='calendar'></div>
</div>
</div>
So, the "blueBackground" is for changing the entire webpage background to blue colour.因此,“blueBackground”用于将整个网页背景更改为蓝色。 The "container" class if for resizing the fullcalendar to a more appropiate view.
“容器”类用于将完整日历调整为更合适的视图。
This is the Javascript code:这是Javascript代码:
$(document).ready(function () {
// page is now ready, initialize the calendar...
$('#calendar').fullCalendar({
// put your options and callbacks here
})
});
The javascript code is straight from the fullcalendar Usage page.( https://fullcalendar.io/docs/usage/ ) javascript 代码直接来自 fullcalendar 使用页面。( https://fullcalendar.io/docs/usage/ )
So, how do I customize it?那么,如何自定义呢? I am a complete newbie at javascript.
我是 javascript 的完全新手。 I look around on the other questions similar to this but it bears no fruits.
我环顾其他与此类似的问题,但没有结果。 I can't make it work.
我不能让它工作。
Thank you in advance.先感谢您。
I am currently also using fullcalendar and here is some of the customization i have made:我目前也在使用 fullcalendar,这是我所做的一些自定义:
$(document).ready(function () {
// page is now ready, initialize the calendar...
$('#calendar').fullCalendar({
//Changing the header like this:
header:
{
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
//Lets us edit in the calendar
editable: true,
//When u select some space in the calendar do the following:
select: function(start, end, allDay){
//do something when space selected
},
//When u click on an event in the calendar do the following:
eventClick: function(event, element) {
//do something when event clicked
},
//When u drop an event in the calendar do the following:
eventDrop: function(event, delta, revertFunc) {
//do something when event is dropped at a new location
},
//When u resize an event in the calendar do the following:
eventResize: function(event, delta, revertFunc) {
//do something when event is resized
},
//Add some test events.
events: [
{
title : 'event1',
start : '2016-09-15'
},
{
title : 'event2',
start : '2016-09-15',
end : '2016-09-16'
},
{
title : 'event3',
start : '2016-09-15T12:30:00',
allDay : false // will make the time show
}
]
})
});
In my project I also use PHP and MySQL to store and change the events.在我的项目中,我还使用 PHP 和 MySQL 来存储和更改事件。 Other than that almost all the customization's you can do are listed in the docs.
除此之外,您可以执行的几乎所有自定义操作都列在文档中。
EDIT #1 How to change the basic color settings etc: Changing the whole background color:编辑 #1 如何更改基本颜色设置等:更改整个背景颜色:
<div id="calendar" style="background:#de1f1f;"></div>
Changing the event background color (when you drag a new event the background is not blue anymore but red):更改事件背景颜色(当您拖动新事件时,背景不再是蓝色而是红色):
$(document).ready(function() {
$('#calendar').fullCalendar({
eventBackgroundColor: "#de1f1f"
});
});
Changing the event color (not blue anymore but red):更改事件颜色(不再是蓝色而是红色):
$('#calendar').fullCalendar({
events: [
// my event data
],
eventColor: "#de1f1f"
});
Changing the border color for the events:更改事件的边框颜色:
$('#calendar').fullCalendar({
eventBorderColor: "#de1f1f"
});
Hope that clarified just some of the customization you can do :)希望能澄清一些你可以做的定制:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.