Touch Event in Jquery

Asked

Viewed 258 times

1

I’m starting in jquery and I’m having trouble touching for this function, it doesn’t work on mobile.

$('#font_family').change(function() {
        svgCanvas.setFontFamily(this.value);
});

document.addEventListener("touchstart", touchHandler, true);
document.addEventListener("touchmove", touchHandler, true);
document.addEventListener("touchend", touchHandler, true);
document.addEventListener("touchcancel", touchHandler, true);

function touchHandler(event)
{   

    var touches = event.changedTouches,
        first = touches[0],
        type = "";
         switch(event.type)
    {
        case "touchstart": type="mousedown"; break;
        case "touchmove":  type="mousemove"; break;        
        case "touchend":   type="mouseup"; break;
        default: return;
    }
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.