16

We've been working on an iPad app and are using jQuery Mobile to handle events like swipes (to change pages). In testing the app it became apparent the default swipe configuration variables didn't feel right. It was too sensitive to swiping when trying to scroll and vice versa.

We've played with the configuration variables but we're not sure we're understanding what each configuration variable does. We've made a graphic to help us understand how they all work together. Are we understanding this correctly or missing anything?

jQuery Mobile Swipe Configuration (in the style of Comic Sans)

Brett DeWoody
  • 59,771
  • 29
  • 135
  • 184

1 Answers1

7

Not sure if this will help but jQM posted this in the blog

Configurable swipe event thresholds added

There were a number of hard-coded constants in the jquery.mobile.event.js swipe code. For developers who need to tweak those constants to allow a greater vertical displacement and still register a swipe, this new feature allows them to be adjusted. Thanks to mlitwin for contributing this.

  • scrollSupressionThreshold (default: 10px) – More than this horizontal displacement, and we will suppress scrolling
  • durationThreshold (default: 1000ms) – More time than this, and it isn’t a swipe
  • horizontalDistanceThreshold (default: 30px) – Swipe horizontal displacement must be more than this.
  • verticalDistanceThreshold (default: 75px) – Swipe vertical displacement must be less than this.

Related Questions:

Community
  • 1
  • 1
Phill Pafford
  • 83,471
  • 91
  • 263
  • 383
  • I based the 3rd-grade level illustration off those definitions but we were still finding it a bit hard to wrap our heads around. To me, the verticalDistanceThreshold should really be named swipeSupressionThreshold. I think that would've cleared up a lot of the confusion for us. – Brett DeWoody Jan 25 '12 at 22:09
  • For that I would suggest adding a Feature Request to the Wiki: https://github.com/jquery/jquery-mobile/wiki and/or following the Dev's on Twitter @jquerymobile to pose your request – Phill Pafford Jan 26 '12 at 16:38
  • Great idea, here's my request - https://github.com/jquery/jquery-mobile/wiki/Request:-Change-verticalDistanceThreshold-to-swipeSupressionThreshold-for-consistency – Brett DeWoody Jan 26 '12 at 18:22
  • Also you can see what's being planned: https://github.com/jquery/jquery-mobile/wiki/1.next-planning – Phill Pafford Jan 26 '12 at 19:08