【发布时间】:2012-06-10 04:39:44
【问题描述】:
两年多以前,这里有人问过这个问题,但作为菜鸟,我不知道如何使用 Joel Potter 发布的方法来回答此 URL 中的问题:
Fullcalendar jquery plugin Show years on nextYear buttons
这是我目前的代码:
$('.fc-button-prevYear span').click(function(){
setYearButtons();
});
$('.fc-button-nextYear span').click(function(){
setYearButtons();
});
function setYearButtons(){
var currentDate = $("#calendar").fullCalendar( 'getDate' );
// I'm not 100% sure on these class names, but you can inspect the dom and figure those out
$(".fc-button-prevYear span").text(currentDate.getYear());
$(".fc-button-nextYear span").text(currentDate.getYear() + 2);
}
如何初始化代码,以便在日历开始时,我将不再看到下一年和上一年的箭头,而是在文本中看到下一年和上一年?
此外,计算年份的逻辑似乎有效,但我看到的文字是错误的。例如,如果当前年份是 2012 年(最初我看到箭头按钮,我需要单击上一年或下一年按钮才能更改为文本),当我单击下一年或上一年转到 2013 年时,我的文本按钮上一年显示 112,下一年显示 114,而不是上一年显示 2012,下一年显示 2014。
【问题讨论】:
-
我加了an updated answer to the question you linked,或许对你也有帮助。
标签: jquery button text fullcalendar next