gpt4 book ai didi

jquery-plugins - 如何在fullcalendar(jquery插件)中绑定(bind)年月下拉菜单?

转载 作者:行者123 更新时间:2023-12-02 01:14:11 24 4
gpt4 key购买 nike

我的要求是将这两个下拉列表与 fullcalendar 绑定(bind)并反射(reflect)相应的更改。
我已经搜索了很多关于将自定义下拉列表绑定(bind)到完整日历但还没有成功!

所以任何帮助表示赞赏。

Need these dropdown bind with the fullcalendar

最佳答案

$(document).ready(function() {
var $months = $('#months');
var $calendar = $('#calendar');

$calendar.fullCalendar({
viewRender: function() {
buildMonthList();
}
});

$('#months').on('change', function() {
$calendar.fullCalendar('gotoDate', $(this).val());
});

buildMonthList();

function buildMonthList() {
$('#months').empty();
var month = $calendar.fullCalendar('getDate');
var initial = month.format('YYYY-MM');
month.add(-6, 'month');
for (var i = 0; i < 13; i++) {
var opt = document.createElement('option');
opt.value = month.format('YYYY-MM-01');
opt.text = month.format('MMM YYYY');
opt.selected = initial === month.format('YYYY-MM');
$months.append(opt);
month.add(1, 'month');
}
}
});

请检查此 fiddle 以获取完整日历的月份和年份下拉列表。

https://jsfiddle.net/L6a5LL5b/

关于jquery-plugins - 如何在fullcalendar(jquery插件)中绑定(bind)年月下拉菜单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43494762/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com