在FullCalendar上放置图标';s头
我在FullCalendar的标题上放了一个CustomButton,但我需要放一个字体很棒的图标在FullCalendar上放置图标';s头,fullcalendar,font-awesome,Fullcalendar,Font Awesome,我在FullCalendar的标题上放了一个CustomButton,但我需要放一个字体很棒的图标 customButtons: { btnBloquearAgenda: { icon: 'fa fa-lock', click: function() { alert('clicked the custom butto
customButtons: {
btnBloquearAgenda: {
icon: 'fa fa-lock',
click: function() {
alert('clicked the custom button!');
}
}
},
header: {
left: 'prev,next',
center: 'title',
right: 'btnBloquearAgenda agendaDay,agendaWeek,month'
},
按钮显示“未定义”。将图标放在FullCalendar的标题上,而不更改代码, 用css试试看 把这个放在diplay中:
viewDisplay : function(view) {
$(".fc-button-month").find(".fc-button-content").addClass("icocon");
},
CSS
很简单,只需使用一些jquery来替换buttontext
$(".fc-today-button").html('<i class="fa fa-calendar"></i>');
$(“.fc今日按钮”).html(“”);
图标值被附加到“fc icon-”中,并作为类添加到按钮的span元素中,即
btnBloquearAgenda: {
icon: 'fa fa-lock',
click: function() {
alert('clicked the custom button!');
}
}
会导致
<button type="button" class="fc-btnBloquearAgenda-button fc-button fc-state-default fc-corner-right">
<span class="fc-icon fc-icon-fa fa-lock"></span>
</button>
结果:
<button type="button" class="fc-btnBloquearAgenda-button fc-button fc-state-default fc-corner-right">
<span class="fc-icon fc-icon-fa fa fa-lock"></span>
</button>
仅供参考:fa-fa-lock
代表字体很棒,而不是引导twitter。这是一个基于类的系统。请检查此线程以了解您要查找的信息:它对我不起作用,因为fc icon类使用以下规则:字体系列:“fcicons”!重要的;因此,您必须使用.fc-icon.fc-icon-fa{font-family:“FontAwesome”!important;}1来覆盖它$(“button.fc-btnBloquearAgenda-button span”).removeClass();2. $(“button.fc-btnBloquearAgenda-button span”).html(“”);--我已经用这些代码行修复了这个问题。
customButtons: {
btnBloquearAgenda: {
icon: 'fa fa fa-lock',
click: function() {
alert('clicked the custom button!');
}
}
},
header: {
left: 'prev,next',
center: 'title',
right: 'btnBloquearAgenda agendaDay,agendaWeek,month'
},
<button type="button" class="fc-btnBloquearAgenda-button fc-button fc-state-default fc-corner-right">
<span class="fc-icon fc-icon-fa fa fa-lock"></span>
</button>