I have a click event:
$('#ddTestOverlay').on('click', function () {
$('#ddTestOverlay').toggle();
});
This is triggered on Android, which is a problem, because I already have jQuery touchstart
, touchend
, etc events that are working fine on iOS (and are triggering on Android too). When both touch and click events are active, on Android, I tap on the element and it shows itself then hides immediately, and tapping again does nothing. However, if I comment out the click event code, it works fine on Android. Problem is, it needs to be working on desktop. I've tried removing the touch events, but then the tap doesn't work on iOS. Also tried substituting the click event for mousedown
and no change. How do I resolve this problem?
Here's my full jQuery:
function handleOverlayInteraction() {
$('.mosaic-wrapper').on('mouseenter', function () {
$('#ddTestOverlay').show();
}).on('mouseleave', function () {
$('#ddTestOverlay').hide();
});
var dragged = false;
$('.mosaic-wrapper').on('touchstart', function () {
dragging = false;
});
$('.mosaic-wrapper').on('touchmove', function () {
dragging = true;
});
$('.mosaic-wrapper').on('touchend', function () {
if (dragging) {
return;
}
// Mobile single tap only
$('#ddTestOverlay').toggle();
});
$('#ddTestOverlay').on('click', function () {
$('#ddTestOverlay').toggle();
});
};