Calculate swipe distance in jQuery-mobile

后端 未结 3 920
[愿得一人]
[愿得一人] 2020-12-11 16:52

I hope you are well today, I am trying to calculate the swipe distance (a touch gesture) on a mobile website, how would you work out how many pixels the user has swiped acro

3条回答
  •  半阙折子戏
    2020-12-11 17:31

    Not sure if this helps but with Beta 2 they have released some additional swipe functionality

    • http://jquerymobile.com/blog/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.

提交回复
热议问题