fullCalendar添加自定義按鈕

​​​​​​​//fullCalendar3.0以後的版本
 $('#calendar').fullCalendar({
            customButtons: {
                myCustomButton: {
                    text: '自定義按鈕', click: function () {
                        alert('點擊了自定義按鈕!');
                    }
                }
            }, 
            header: {
                left: 'prev,next today myCustomButton', 
                center: 'title', 
                right: 'month,agendaWeek,agendaDay'}
});


//3.0以前的版本
 $('.fc-toolbar .fc-right').prepend(
            $('<button type="button" class="fc-button fc-state-default fc-corner-left fc-corner-right">登陸日程</button>')
                .on('click', function() {
                    var title = prompt('登錄日程');
                    if (title) {
                        $('#calendar').fullCalendar(
                            'addResource',
                            { title: title },
                            true 
                        );
                    }
                })
        );

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章