在中间滑动以使用jQuery Mobile打开面板吗? [英] Swipe in the middle to open panel with jQuery Mobile?

查看:117
本文介绍了在中间滑动以使用jQuery Mobile打开面板吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的导航头中有一个小条按钮,单击该按钮可以打开面板,但是如何制作,以便当我从应用程序的中间向右滑动时,它可以打开左侧面板?您可以在许多本地应用程序(包括Facebook)上看到此内容.感谢您的帮助!

I have a small bars button in my nav header that opens the panel when clicked, but how do I make it so that when I swipe to the right from the middle of the app, it opens the left panel? You can see this on many native apps including Facebook. Thanks for any help!

推荐答案

我认为这就是您想要的(您可能希望针对滑动区域优化选择器)-

I think this is what you'll want (you may want to refine your selector for your swipe area) -

$('body').on('swiperight', function () {
    $('#defaultpanel').panel('open', '');
});

$('body').on('swipeleft', function () {
    $('#defaultpanel').panel('close');
});

jsFiddle演示

这篇关于在中间滑动以使用jQuery Mobile打开面板吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆