我有两个
第一个函数可以正常工作。用两个手指左右滑动。我的问题是,这会禁用iPad上普通的单指页面滚动。
问题: 我想用两根手指运行左右滑动功能(可行),但是我想在单指滑动时启用
使用的插件可以在这里找到:https://github.com/mattbryson/TouchSwipe-Jquery-Plugin
$('body').swipe();
函数,很明显它们不能一起运行,因为第二个会取消我想要做的事情(两个函数在同一个DOM元素上运行等)...第一个函数可以正常工作。用两个手指左右滑动。我的问题是,这会禁用iPad上普通的单指页面滚动。
问题: 我想用两根手指运行左右滑动功能(可行),但是我想在单指滑动时启用
allowPageScroll: 'vertical'
。我该如何完成这个任务?我无法想出一种方法在swipeLeft:
和swipeRight:
函数中运行选项(例如allowPageScroll: 'vertical'、threshold: 200、fingers: 2)。使用的插件可以在这里找到:https://github.com/mattbryson/TouchSwipe-Jquery-Plugin
$('body').swipe({
swipeLeft: function (event, direction, distance, duration, fingerCount) {
// set cookie
$.cookie('sb-swipe', 'inactive', { expires: 1 });
//This only fires when the user swipes left
openDashboard();
// hide swipe instructions, if applicable
$('div.instructions-overlay').fadeOut('slow');
},
swipeRight: function (event, direction, distance, duration, fingerCount) {
//This only fires when the user swipes right
closeDashboard();
$('#employee-dash-btn').hide();
},
allowPageScroll: 'vertical',
threshold: 200,
fingers: 2
});
$('body').swipe({
allowPageScroll: 'vertical',
fingers: 1
});