Fullcalendar - 通过拖动触摸设备删除事件

时间:2018-04-05 12:08:37

标签: jquery jquery-ui touch draggable fullcalendar-3

我遇到Fullcalendar 3.9.0的问题。

Option Explicit

Sub Dates()

Dim i As Long
Dim k As Long
Dim MyDate As Long
Dim EndDate As Long
Dim EndRowA As Long
Dim EndRowB As Long
Dim EndRowH As Long
Dim EndRow As Long
Dim StartDate As Long
Dim ws As Worksheet

Set ws = Worksheets("Sheet1")

With ws
    StartDate = .Cells(.Rows.Count, "H").Value
    MyDate = .Cells(.Rows.Count, "B").Value
    EndDate = .Cells(.Rows.Count, "I").Value
    EndRowA = .Cells(.Rows.Count, 1).End(xlUp).Row
    EndRowB = .Cells(.Rows.Count, 2).End(xlUp).Row
    EndRowH = .Cells(.Rows.Count, 8).End(xlUp).Row

    ' get the minimumm last row from: EndRowA, EndRowB, EndRowH
    EndRow = WorksheetFunction.Min(EndRowA, EndRowB, EndRowH)

    For i = 1 To EndRow ' <-- starting loop from the 1st row
        If .Cells(i, "H").Value = .Cells(i, "I").Value Then
            GoTo Continue
        ElseIf .Cells(i, "H").Value = .Cells(i, "I").Value Then ' <-- same exact criteria as in your If
            For k = 1 To ws.Cells(i, k).Value
                ws.Cells(i + 1, "B").Select ' <-- not sure what do you need this line ???
                .Cells(i, "B").Value = .Cells(i - 1, "H").Value + 1
                Exit For
Continue: '<-- not sure if this is placed correctly ??
            Next k
        End If
    Next i

End With

End Sub

我使用上面的代码来获取日历事件并将其移至垃圾桶,删除该事件。但是,这在触摸设备上无法正常工作。

我可以将事件拖得很好,但是将它移到垃圾箱并放手并不起作用。 但是,如果我将其拖到垃圾箱,请放开并立即点击垃圾箱,该活动将被删除。

1 个答案:

答案 0 :(得分:0)

我不知道你的变量“currentMousePos”。但如果我没有弄错,我对你的问题有所了解。在html5中,您无法通过jsEvent.pageX获取触摸设备的位置。一个想法是使用jsEvent.changedTouches[0].clientX。这是您离开屏幕的最后一根手指的位置。

var currentMousePos = new Object();
if (jsEvent.type === 'touchend') {
    currentMousePos.x = jsEvent.changedTouches[0].clientX;
    currentMousePos.y = jsEvent.changedTouches[0].clientY;
} else {
    currentMousePos.x = jsEvent.pageX;
    currentMousePos.y = jsEvent.pageY;
}

希望这有帮助。