Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello

can you please tell me how to get x and y coordinate of long press touch event using jquery.touchy.js .

Thanks
Posted

1 solution

Hello Ravi,

The current version does not pass this information for longpress event. So you probably have to modify the source code of the library. Although not tested by me, the below code snippet shows the possible change required in case statement
JavaScript
case 'longpress':
    data.startPoint = {
        "x": touches[0].pageX,
        "y": touches[0].pageY
    };
    data.startDate = e.timeStamp;
    if (settings.triggerStartPhase) {
        $target.trigger('touchy-longpress', ['start', $target, {
            "startPoint": data.startPoint}
        ]);
    }
    data.timer = setTimeout($.proxy(function() {
        $target.trigger('touchy-longpress', ['end', $target, {
            "startPoint": data.startPoint
        ]);
    }, this), settings.msThresh);
    break;

Regards,
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900