获取滑动方向和速度 jQTouch jQuery

发布于 2024-09-11 14:04:43 字数 616 浏览 0 评论 0原文

我有以下 javascript:

    var jQT = new $.jQTouch({
            touchSelector: '#swipeme',
            fixedViewport: false,
            fullScreen: false
            });

            $('#swipeme').bind('swipe', function(evt, data) {
                $('#gallery').css('margin-left',parseInt($('#gallery').css('margin-left'))-100 );
            });

现在这是非常基本的,当我滑动它时它会改变图库的边距。

理想情况下,我希望最终画廊根据滑动的方向和速度左右滑动(通过更改边距)。

然而,我在试图弄清楚这些问题时遇到了麻烦,因为我不知道这些变量在哪里。

我已经尝试过在 evt 和 data 上使用 console.log,但在 iPhone 上它没有提供太多详细信息,并且在任何地方都找不到任何像样的 jQTouch 文档。

任何建议表示赞赏, 谢谢。

I have the following javascript:

    var jQT = new $.jQTouch({
            touchSelector: '#swipeme',
            fixedViewport: false,
            fullScreen: false
            });

            $('#swipeme').bind('swipe', function(evt, data) {
                $('#gallery').css('margin-left',parseInt($('#gallery').css('margin-left'))-100 );
            });

Now this is very basic, it changes the margin of the gallery when I swipe it.

Ideally Id like to end up withe gallery sliding left and right (by changing margins) depending on the direction and speed swiped.

However I am having trouble trying to figure these out as I don't know where these variables are.

Ive tried console.log on evt and data but on the iPhone it doesn't give you much details and cannot find any decent documentation for jQTouch anywhere.

Any advice appreciated,
Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

手心的温暖 2024-09-18 14:04:43

文档说你可能想看看你的监听器 fn 中的 data.direction (“左”或“右”)。不过,关于滑动速度的信息并不多。在这里提问:http://blog.jqtouch.com/submit

docs says you might want to have a look at data.direction ("left" or "right ")in your listener fn. not a lot about swipe speed though. Ask here: http://blog.jqtouch.com/submit

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文