$('#calendar').fullCalendar({
header: {
left: /*'prev,next'*/'BackwardButton,ForwardButton',
center: 'title',
right: '',
},
customButtons: {
ForwardButton: {
//text: 'Framåt',
click: function () {
}
},
BackwardButton: {
//text: 'Bakåt',
click: function () {
}
}
},
buttonsIcons: {
BackwardButton: 'left-single-arrow',
ForwardButton: 'right-single-arrow',
},
});
<link href="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.9.0/fullcalendar.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.0/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.9.0/fullcalendar.js"></script>
<div id="calendar"></div>
我正在使用FullCalender.io。我有两个自定义按钮,我想向其中添加默认V形或箭头。我找到了这些properties,但是我不知道应该在完整日历初始化中的哪个位置放置它。到目前为止没有任何工作。我只得到“未定义”文本。任何人都有吗?
jQuery('#calendar').fullCalendar({
header: {
left: 'BackwardButton,ForwardButton',
center: 'title',
right: '',
},
customButtons: {
ForwardButton: {
//text: 'Framåt',
click: function () {
}
},
BackwardButton: {
//text: 'Bakåt',
click: function () {
}
},
buttonsIcons: {
BackwardButton: 'left-single-arrow',
ForwardButton: 'right-single-arrow',
}
});
最佳答案
编辑:下面的代码可以工作,但是OP的代码是正确的,除非有错字(应该是buttonIcons
而不是buttonsIcons
)。在这里查看@ADyson的JSFiddle:http://jsfiddle.net/sbxpv25p/510/
原始:
我想这可能是您想要的:https://codepen.io/anon/pen/KoLZXq
您似乎在尝试将图标添加到错误的位置:
$("#calendar").fullCalendar({
header: {
left: "BackwardButton, ForwardButton",
center: "title"
},
customButtons: {
ForwardButton: {
icon: "right-single-arrow",
click: function() {}
},
BackwardButton: {
icon: "left-single-arrow",
click: function() {}
}
}
})
请注意,每个按钮现在都具有
icon
属性。