Javascript 如何在完整日历的标题中添加纯文本
我使用了fullCalendar.js,标题内容有:今天、月、年、上一个、下一个,还制作了一个自定义的添加按钮,现在我想在添加按钮前面添加一个简单的文本,上面写着“请求新类”,最后看起来是这样的: 现在我的标题看起来像: 以下是迄今为止的代码:Javascript 如何在完整日历的标题中添加纯文本,javascript,jquery,fullcalendar,Javascript,Jquery,Fullcalendar,我使用了fullCalendar.js,标题内容有:今天、月、年、上一个、下一个,还制作了一个自定义的添加按钮,现在我想在添加按钮前面添加一个简单的文本,上面写着“请求新类”,最后看起来是这样的: 现在我的标题看起来像: 以下是迄今为止的代码: $('sfullCalendar').fullCalendar({ 自定义按钮:{ myCustomButton:{ 主题:“真实”, 文本:“”, 单击:函数(){ 警报('单击自定义按钮!'); } } }, defaultView:'月份', 标
$('sfullCalendar').fullCalendar({
自定义按钮:{
myCustomButton:{
主题:“真实”,
文本:“”,
单击:函数(){
警报('单击自定义按钮!');
}
}
},
defaultView:'月份',
标题:{
左:"今日",,
中心:'标题',
右:“上一个,下一个myCustomButton”
},
});代码>
您可以尝试:
$('#calendar').fullCalendar({
customButtons: {
myCustomButton: {
theme: 'true',
text: '',
click: function() {
alert('clicked the custom button!');
}
}
},
defaultView: 'month',
header: {
left: 'today',
center: 'title',
right: 'prev,next myCustomButton'
},
eventAfterAllRender: function(view) {
if ($('.label').length == 0) {
$('.fc-myCustomButton-button').before('<div class="label">test</div>');
}
}
});
$(“#日历”).fullCalendar({
自定义按钮:{
myCustomButton:{
主题:“真实”,
文本:“”,
单击:函数(){
警报('单击自定义按钮!');
}
}
},
defaultView:'月份',
标题:{
左:"今日",,
中心:'标题',
右:“上一个,下一个myCustomButton”
},
eventAfterAllRender:函数(视图){
如果($('.label')。长度==0){
$('.fc myCustomButton button')。在('test')之前;
}
}
});
您可以尝试:
$('#calendar').fullCalendar({
customButtons: {
myCustomButton: {
theme: 'true',
text: '',
click: function() {
alert('clicked the custom button!');
}
}
},
defaultView: 'month',
header: {
left: 'today',
center: 'title',
right: 'prev,next myCustomButton'
},
eventAfterAllRender: function(view) {
if ($('.label').length == 0) {
$('.fc-myCustomButton-button').before('<div class="label">test</div>');
}
}
});
$(“#日历”).fullCalendar({
自定义按钮:{
myCustomButton:{
主题:“真实”,
文本:“”,
单击:函数(){
警报('单击自定义按钮!');
}
}
},
defaultView:'月份',
标题:{
左:"今日",,
中心:'标题',
右:“上一个,下一个myCustomButton”
},
eventAfterAllRender:函数(视图){
如果($('.label')。长度==0){
$('.fc myCustomButton button')。在('test')之前;
}
}
});
我今天正在寻找类似的东西,但就我而言,我只想在工具栏的中心元素中插入自定义文本,而不是额外的按钮。在查看了标题工具栏的CSS后,我想出了这个方法,将文本放在工具栏的中心(这是在fullcalendar scheduler的5.3.0版上,不知道其他版本的CSS是否相同):
我今天也在寻找类似的东西,但在我的例子中,我只想在工具栏的中心元素中插入自定义文本,而不是额外的按钮。在查看了标题工具栏的CSS后,我想出了这个方法,将文本放在工具栏的中心(这是在fullcalendar scheduler的5.3.0版上,不知道其他版本的CSS是否相同):
酷我很高兴能帮上忙!酷我很高兴能帮上忙!