I have two functions $('body').swipe(); below, which obviously cannot work together, because the second cancels out what I want to do (two functions are executed on the same DOM element, etc.) ...
The first function works as it should. Swipe left and right with two fingers. My problem is that this disables the normal one-finger page scroll that could be done on the iPad.
Question: I want to run swipe left and right with two fingers (it works), however I want to enable allowPageScroll: 'vertical' on one finger of my finger. How can i do this? I can’t determine how to start the parameters (i.e. AllowPageScroll: "vertical", threshold: 200, fingers: 2) only in the swipeLeft: and swipeRight: functions.
The plug-in used can be found here: 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 });
source share