gpt4 book ai didi

javascript - fullcalendar 记住用户选项,例如。 cookie 中的月/周/日

转载 作者:可可西里 更新时间:2023-11-01 02:23:20 27 4
gpt4 key购买 nike

我如何修改 fullcalendar插件,以便将不同的点击方法 dayClick 等保存在 cookie 中?下次打开此日历时,如果默认为用户首选项。

已经在使用 cookie 插件:https://raw.github.com/carhartl/jquery-cookie/master/jquery.cookie.js

根据回答更新工作 cookie 代码:

var calendarView = (!$.cookie('calendarDefaultView')) ? 'month' : $.cookie('calendarDefaultView');  
$calendar.fullCalendar({
defaultView: calendarView,
viewDisplay: function(view){
$.cookie('calendarDefaultView', view.name, {expires:7, path: '/'});
},

最佳答案

您需要的两个完整日历方法是:

//pull viewName from the cookie or set as default
var viewName='month'; //or basicWeek, basicDay, agendaWeek, agendaDay
$("#fullcalendar").fullCalendar( 'changeView', viewName );

$('#fullcalendar').fullCalendar({
viewDisplay: function( view )
{
//save your cookie here, it's triggered each time the view changes
}
});

这应该会让您走上正确的道路。我没有考虑保存 cookie b/c 我认为你已经控制住了。

关于javascript - fullcalendar 记住用户选项,例如。 cookie 中的月/周/日,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12573134/

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