pressAndHold
pressAndHold copied to clipboard
Mobile not works
Testing in Safari from iPhone, not work.
I have same issue with mobile. tested in google chrome.
I fixed my problem by mimicking mousedown
and mouseup
events with touchstart
and touchend
events on target element.
$(".target").on('touchstart', function(){
$(this).trigger("mousedown");
});
$(".target").on('touchend', function(){
$(this).trigger("mouseup");
});
You need to do a little more than that, because long presses on mobiles are basically right clicks. There's a mouseexit event too, that you need to replace.
Suggest to use pointerdown, pointerup, pointerout instead, that'll be a way cleaner solution.