dayClick在移动设备上触发,但不在桌面浏览器上触发

时间:2016-11-23 19:45:30

标签: javascript fullcalendar

我知道这个问题已被多次询问,但我的版本略有不同。我正在显示FullCalendar(v3.0.1)并想要设置dayClick事件。

该事件在我的iPhone上触发,但在Mac上的Chrome或Safari中无法触发。

用户控制:

<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="BookingForm.ascx.cs" Inherits="RPL.KW.ControlTemplates.BookingForm" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI.WebControls" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>

<!-- form smipped for berevity -->
<div id="calendar"></div>

初始化JS:

requirejs(['knockout'], function(ko) {  
    requirejs(['frameworks/knockstrap.min'], function() {

        requirejs(['moment'], function(moment) {
            requirejs(['components/FullCalendar/fullcalendar.min'], function() {

                $("#calendar").fullCalendar({
                    aspectRatio: 3,
                    header: {
                        left: 'title',
                        center: '',
                        right: 'today prev,next'
                    },                  
                    dayRender: function (date, cell) {
                        var today = new Date();

                        cell.css("background-color", "#EEE");

                        if(date.day() > 4)
                        { cell.css("background-color", "#f2dede"); }

                        if(date.isSame(new Date(), "day"))
                        { cell.css("background-color", "#DDD"); }
                    },
                    dayClick: function (date, jsEvent, view) {

                        $(".type1event").hide();
                        $(".type2event").hide();
                        $(".type3event").hide();

                        var selectedDate = date.format("YYYYMMDD")

                        $(".type1event."+selectedDate).show();
                        $(".type2event."+selectedDate).show();
                        $(".type3event."+selectedDate).show();
                    }
                });
            });
        });
    });
});

它渲染得很好,而且dayClick甚至可以在我的iPhone上激活,但不能在我的桌面浏览器上激活。

有什么想法吗?

0 个答案:

没有答案