gpt4 book ai didi

jquery-mobile - 在 jQuery-mobile 中计算滑动距离

转载 作者:行者123 更新时间:2023-12-04 06:09:08 25 4
gpt4 key购买 nike

我希望你今天一切都好,我正在尝试计算移动网站上的滑动距离(触摸手势),你如何计算用户在屏幕上滑动了多少像素?

$('.cmButtons').live('swipeleft',function(){
console.log("swiped left");
});

最佳答案

不确定这是否有帮助,但在 Beta 2 中,他们发布了一些额外的滑动功能

  • 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.

    关于jquery-mobile - 在 jQuery-mobile 中计算滑动距离,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6924671/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com