【问题标题】:Calendar plugin for displaying opening hours for specific days?用于显示特定日期的营业时间的日历插件?
【发布时间】:2011-04-07 13:23:31
【问题描述】:

我需要一个日历插件(最好用于 jQuery 甚至更好的 WordPress),它可以在单击日期时显示营业时间。

营业时间因星期几和季节而异。

我已经查看了各种日历插件,但其中大多数是日期选择器或面向发布事件的。

【问题讨论】:

    标签: javascript jquery wordpress jquery-plugins calendar


    【解决方案1】:

    FullCalendar 会做你想做的事。

    您需要为 dayClick 事件 (documentation) 设置一个处理程序。

    例如:

    $("#calDiv").fullCalendar(
    dayClick: function(date, allDay, jsEvent, view) {
        // change the day's background color just for fun
        $(this).css('background-color', '#6495ED');
    
        // assuming a call that goes to the server and gets HTML for an opening hours popup
        $.ajax(
             url: '/path/to/get/hours',
             data: {'date' : date}, // pass the date as a param,
             dataType: 'html',
             success: function(data) {
                 $("#divForPopup").html(data).show();
             }
        );
    }
    );
    

    或者,您可以为每天创建一个显示开放时间(或总开放时间,包括关闭时间)的事件。

    【讨论】:

    • 谢谢你。这是非常有用的。但是每天举办一个活动听起来像是一项繁重的工作。是否可以设置这样的规则:八月天(X 开放时间),八月星期三(y 开放时间)?
    • @0al0 - 你可以很容易地在服务器端(取决于你的服务器端语言)甚至在 Javascript 中做到这一点 - 这只是代码。要了解 fullcalendar 如何处理事件,请查看文档。
    猜你喜欢
    • 2020-08-11
    • 2015-02-25
    • 1970-01-01
    • 2023-03-21
    • 1970-01-01
    • 1970-01-01
    • 2020-11-18
    • 2014-11-18
    • 1970-01-01
    相关资源
    最近更新 更多