小编use*_*524的帖子

fullcalendar上一页和明年按钮在文本中

两年前,这个问题在这里被问到但是是一个菜鸟,我不知道如何使用Joel Potter发布的方法作为这个URL中问题的答案:

Fullcalendar jquery插件显示在nextYear按钮上的年份

以下是我目前在代码中的内容:

$('.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);
        }
Run Code Online (Sandbox Code Playgroud)

如何初始化代码,以便在日历的开头,我不会再看到下一年和前一年的箭头,而是下一年和前一年的文本?

此外,计算年份的逻辑似乎有效,但我看到的文字是错误的.例如,如果当前年份是2012年(最初我看到箭头按钮,我需要在更改为文本之前点击上一个或明年按钮),当我点击下一年或上一年去2013年时,我的文本按钮显示上一年的112和下一年的114,而不是显示2012年的上一年和2014年的下一年.

jquery text button next fullcalendar

3
推荐指数
1
解决办法
7380
查看次数

标签 统计

button ×1

fullcalendar ×1

jquery ×1

next ×1

text ×1