jquery Mobile's touch-click event will trigger the solution of the problem multiple times _jquery

Source: Internet
Author: User

The jquery Mobile provides a few of the following event monitoring for gesture touch:

Copy Code code as follows:

Tap triggers when the user points the screen
Taphold triggers when the user points the screen and holds the touch for more than 1 seconds
Swipe is triggered when the page is dragged vertically or horizontally. This event has properties associated with it, namely Scrollsupressionthreshold, Durationthreshold, Horizontaldistancethreshold, and Verticaldistancethreshold
Swipeleft trigger when the page is dragged to the left direction
Swiperight trigger when the page is dragged to the right direction

However, the tap incident was tested on WINDOWS8 touch devices and Android devices, with one click triggered repeatedly.
After testing, the Tap method response time is significantly faster than the OnClick event, then we can use the Click event to handle the tap event corresponding. Sample code references are as follows:

However, the tap incident was tested on WINDOWS8 touch devices and Android devices, with one click triggered repeatedly.
After testing, the Tap method response time is significantly faster than the OnClick event, then we can use the Click event to handle the tap event corresponding. Sample code references are as follows:

Copy Code code as follows:

<! DOCTYPE html>
<meta charset= "Utf-8"/>
<meta name= "viewport" content= "Width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<title>jquery Mobile's Tap event triggers problems multiple times-log Studio </title>
<link rel= "stylesheet" href= "Http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css"/>
<script src= "Http://code.jquery.com/jquery-1.9.1.min.js" ></script>
<script src= "Http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js" ></script>
<style>
. Article{height:10000px;text-align:center}
</style>
<body>
<div data-role= ' page ' >
<div data-role= ' header ' data-theme= ' B ' data-position= ' fixed ' >
<a href= ' http://www.jb51.net ' data-icon= ' home ' data-theme= ' d ' data-iconpos= ' notext ' data-transition= ' ' Turn ' > Zhi Wen Studio </a>

<a href= ' #menu-panel ' data-icon= ' bars ' data-theme= ' d ' data-iconpos= ' notext ' ' data-shadow= ' false ' data-iconshadow= ' False ' > Menu </a>
</div><!--/header-->
<div data-role= ' content ' >
<div id= "article" class= "article" >
<ol data-role= "ListView" data-inset= "true" >
</ol>
</div>
</div>
</div>
<script>
Light the screen.
$ (' div#article '). On ("Tap", function (event) {
$ (' div#article '). On ("click", Function (event) {
Event.stoppropagation ();
Console.log (111111);
if (Event.clienty < 80) {
Click the top half of the page to slide up
if (document.body.scrolltop<1) return;
var scrollposy = document.body.scrolltop-document.body.clientheight + 100;
$.mobile.silentscroll (Scrollposy);
}else if (Event.clienty > document.body.clientheight-80) {
var scrollposy = Document.body.scrollTop + document.body.clientheight-100;
if (Scrollposy < document.body.scrollHeight) {//Top overlay height + visible Height < page body height, scroll one screen
$.mobile.silentscroll (Scrollposy);
}
}
});
for (Var i=1;i<200;i++) {
$ (' #article ol '). Append (' <li> ' + i + ' line: Zhi Wen studio </li> ');
}
</script>
</body>

Another workaround reference:
Jquerymobile The Tap event on the Android device will cause multiple triggers, and our solution is to use Google fastbutton to switch places that need to tap into Fastbutton Acting

Another workaround reference:
Jquerymobile The Tap event on the Android device will cause multiple triggers, and our solution is to use Google fastbutton to switch places that need to tap FASTBU Tton processing.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.