Swipe across the screen with jQuery Mobile 1.2, PhoneGap 2.1 and Android 4.0.4 not working properly

I know that there is already a bzillion about it, but I can’t get a solution.

Problem: each gesture is not recognized.

Setup: Android 4.0.4, PhoneGap 2.1 and jQuery Mobile 1.2

On the touch button (scroll or scroll) I get (almost every time)

Miss a drag as we are waiting for WebCore response for touch down. 

The problem is that my installation is not able to detect touchstop properly.

I am using the following at the moment to scroll:

 (".mainList").swipeleft(function() { $.mobile.changePage("status.html", { transition : "slide" }); console.log("swipe left!!!"); }); 

and this allows you to properly run wipes every time:

 // deactivate normal touch handling for swipe to work document.ontouchmove = function(event) { event.preventDefault(); }; 

Thus, scrolling works every time, but scrolling (of course) no longer works. You can only use this function for the page title to make the header β€œswipable” and the content scrollable, but without checking it correctly. But this cannot be a real solution.

I tried the following tips that I collected from different threads:

  • use the ".on" function to bind a swipe event
  • bind swipe event to class, not id
  • Try defining a horizontal scroll using "ontouchstart" and "ontouchend" This does not work, because the touchhend event does not fire on every hit.
  • experiment with various values ​​of scroll constants, such as $ .event.special.swipe.scrollSupressionThreshold

As I thought, perhaps the installation does not show whether the swipe is a real swipe or a horizontal scroll:

  • prevent horizontal scroll through css overflow
  • prevent horizontal scrolling with custom cord image
  • use different values ​​for the viewport meta tag in my html to set the correct page width.

All tests except for the .preventDefault () event; the approach does not change the situation: only every second, third or fourth gesture of gestures is recognized correctly.

Anyone with the same problem and maybe a solution ?: D thanks in advance

+4
source share

Source: https://habr.com/ru/post/1439134/


All Articles