简体   繁体   中英

Tap-and-hold on a day required to activate full calendar day click events

I am using fullcalendar jquery plugin on my site. It works perfectly on my laptop. But on mobile devices when I tap on a day in month view, the modal which is meant to get information about the event user wants to create (start time, end time , event title) doesn't fire up immediately, instead I have to tap and hold on the day for sometime for the modal to appear , same thing happens when I have to create a multi day event, ie. I have to tap and hold on the first day and then after some time the day gets selected and I can move my finger ahead to select more days. Is there any way to fire these events immediately when I tap on the day or maybe reduce the time delay for a smoother experience? Maybe some suggestions? (The code is quite large so I am not adding any snippet but if it will help I could add the fullCalendar options.)
Any advice will be greatly appreciated!! Thank You!!!

you can use touchstart

$(document).on('touchstart', '.fc-day', function(e){
  //..
});

to support click and touchstart you can do this:

var bindEvent = (document.ontouchstart!==null) ? 'click' : 'touchstart';

$(document).on(bindEvent, '.fc-day', function(e){
  //..
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM