2 Replies Latest reply on May 24, 2014 8:00 AM by Xoco

    Swipe accuracy

    Xoco Level 3

      I have a scenario 1280x720 with width and height to 100%. On mobile devices with low resolution, the user must zoom, but when he moves left or right with your finger for to see other parts of stage, then the swipe events are triggered.

      Is it possible to know how fast the user swipe left or right to trigger the events only when the user does so quickly, not when user swipe slowly to view other parts of the stage? I will to use these events for to change between menu options.


      Maybe if there was a way to tell if the user has increased the zoom...

       


      Thanks.

        • 1. Re: Swipe accuracy
          Xoco Level 3

          Well, I found info about swipe | jQuery Mobile API Documentation, but I don't know how to use in Edge.

           

          Edit: I think that I solved searching $.event.special.swipe.durationThreshold in Google and founding JQuery Mobile - change the taphold sensitivity - Stack Overflow


          Implemented in Edge (document.compositionReady):


          $(window).bind("swipeleft", function(sl){

              $.event.special.swipe.durationThreshold = 500; //default: 1000ms

              $.event.special.swipe.horizontalDistanceThreshold = 500; //default: 30px

              canviopcio(sym, activa+1, "h"); //action for to change menu option

          });

          $(window).bind("swiperight", function(sr){

              $.event.special.swipe.durationThreshold = 500;

              $.event.special.swipe.horizontalDistanceThreshold = 500;

              canviopcio(sym, activa-1, "h"); //action for to change menu option

          });

           

          Or add this lines in Stage.swipeleft o Stage.swiperight events. Is working but I don't know if is the best practice for this.

          • 2. Re: Swipe accuracy
            Xoco Level 3

            It's more simply, only is necessary add this lines in creationComplete o document.compositionReady and to use swipeleft o swiperight normally (this lines affect two events):

             

                $.event.special.swipe.durationThreshold = 500;

                $.event.special.swipe.horizontalDistanceThreshold = 500;