I have a problem with the JQuery mobile app I am developing on my Android.
Often when I mean to just scroll a list of items, the taphold even on the item I am touching is triggered.
That's very frustrating for my users.
What can I do about it?
Can I change the sensitivity of the taphold event?
Unfortunately I can't find anything on Google.
Thanks,
Dan
In jQuery-mobile 1.1.*, they have added more convenient ways to configure touch events: http://jquerymobile.com/demos/1.1.1/docs/api/events.html
For taphold, you can change the amount of time a tap should last before triggering the event by assigning a value to $.event.special.tap.tapholdThreshold
.
This value should be set in the mobileinit event, before importing JQM, but after importing jQuery. For instance, I did the following to avoid any overlap between the swipe and taphold events:
<script type="text/javascript" src="/Scripts/jquery.min.js"></script>
<!-- JQM default options must be set after jQuery and before jQuery-mobile -->
<script type="text/javascript">
$(document).bind("mobileinit", function () {
$.event.special.tap.tapholdThreshold = 1000,
$.event.special.swipe.durationThreshold = 999;
});
</script>
<script type="text/javascript" src="/Scripts/jquery.mobile-1.1.0.js"></script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With