I have this
<a href="A.html" data-ajax="false" class="btn">A</a>
<a href="B.html" data-ajax="false">B</a>
<script>
$('a, button').bind('touchstart', function(e) {
$(this).trigger('click');
e.preventDefault();
});
</script>
The code is compile on phonegap + jquery mobile and testing on Nexus S.
My problem is when I touch on both A and B I did not see performance boost, what is happening?
Please help!
Peter this code is not going to give you a speed boost.
You don’t need to bind touchstart on a tag. It is ok to use it on button. There is no point to trigger a click on element with touchstart event, touchstart is an event used to replace click events on mobile devices. But in case of android user tap event to get better performance. Touchstart is used for JQM executed on iPhone/iPad devices.
This is a code I am using to determine a type of tap event:
No matter what event you choose you will have 300ms deley on mobile devices. Some plugins claim they can fix this problem but I never found successful one.
I hope this helps you.