问题
I have found that the taphold (longclick) function for jquery mobile also seems to cause elements to change the same way by "swiping" as well.
A quick proof of this undesired effect is:
http://api.jquerymobile.com/taphold/
If I "swipe" the box well before 750ms it changes color and it bypasses me having to do a taphold (longclick).
As well as this:
http://www.w3schools.com/jquerymobile/tryit.asp?filename=tryjqmob_events_taphold
If I "swipe" the text it also dissapears the same way taphold does.
Threshold changes I tried did not fix this and I would like to know if anyone has a solution to prevent a taphold event on an element from being triggered by "swiping" it as well?
Note: I put "swipe" in quotes because I think it is inherently caused by taphold and not a seperate swipe event. I can't be certain but I have tried tried several things out such as combining swipe and taphold events on a single element with varying thresholds which lead me to think this.
回答1:
In case anyone is interested in an alternative solution. I've discovered a plugin by Rich Adams that has the fix already in place. https://github.com/richadams/jquery-taphold/blob/master/taphold.js
It implements specified boundries for the taphold event. Guess still need to wait for the jquery mobile official to set some boundries to the taphold event of their own but this plugin works just as well and solves the issue for disabling "swipe" on taphold.
来源:https://stackoverflow.com/questions/24542481/how-to-disable-swipe-for-taphold