当前位置: 动力学知识库 > 问答 > 编程问答 >

Understanding jQuery Mobile Swipe Configuration variables

问题描述:

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?

网友答案:

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

  • http://blog.jquerymobile.com/2011/08/03/jquery-mobile-beta-2-released/

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:

  • Does jQuery preserve touch events properties?
  • How to recognize touch events using jQuery in Safari for iPad? Is it possible?
  • How to get position/coordinates of a tap-event with jquery-mobile?
  • Calculate swipe distance in jQuery-mobile
分享给朋友:
您可能感兴趣的文章:
随机阅读: