jQuery   发布时间:2022-03-30  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了在jquery mobile中调整滑动事件的距离大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
是否可以调整触发滑动事件所需的距离,如果是这样,它是如何完成的?

这里的代码我在谈论:

$('.page2').bind('swiperight',function(event,ui){
    $.mobile.changePage(
        $('.page1'),{
          allowSamePageTransition: true,transition: 'slide',reverse: 'true',showLoadMsg: false,reloadPage: true,}
    );
    return false; 
});

解决方法

对的,这是可能的.

您需要修改这些属性

> $.event.special.swipe.horizo​​ntalDistanCEThreshold(认值:30像素) – 刷卡水平位移必须比这个多.
> $.event.special.swipe.verticalDistanCEThreshold(认:960×75像素) – 刷卡垂直位移必须小于这一点.

这必须在mobileinit事件期间完成,如下所示:

$(document).bind("mobileinit",function(){
    $.event.special.swipe.horizontalDistanCEThreshold (default: 30pX);
    $.event.special.swipe.verticalDistanCEThreshold (default: 75pX);
});

最后一件事.如果您从未使用过mobileinit,则必须在初始化jQuery mobile之前调用此事件,如下所示:

<script src="jquery.js"></script>
<script>
    $(document).bind("mobileinit",function(){
        $.event.special.swipe.horizontalDistanCEThreshold (default: 30pX);
        $.event.special.swipe.verticalDistanCEThreshold (default: 75pX);
    });
</script>
<script src="jquery-mobile.js"></script>

请查看官方文档here

大佬总结

以上是大佬教程为你收集整理的在jquery mobile中调整滑动事件的距离全部内容,希望文章能够帮你解决在jquery mobile中调整滑动事件的距离所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。