Open joelray opened 9 years ago
+1
+1
+1, this is a constant complaint in our implementation of slideout.js, and having this addressed would complete its functionality for us :smile:
+1
+1 It would be nice to have horizontal threshold option.
Still no response after almost 2 years. Do people already have alternatives?
More than two years. This is a major pain too.
You can disable touch event initially and enable it only when slideout is openned.
var slideout = new Slideout({
...
});
slideout.once('open', slideout._initTouchEvents);
slideout.on('open', slideout.enableTouch);
slideout.on('close', slideout.disableTouch);
I'd also be interested in hearing if anyone had a better solution for this.
This is not a perfect solution, but to fix some unintended opening of slideout, you can increase the pixel value required for the swipe to trigger slideout.
Line 271 in the current distribution has a default of 20 pixels movement to start opening slideout:
if (Math.abs(dif_x) > 20) {
Currently I am experimenting with setting this number to 40 so that slideout doesn't get triggered as often with small horizontal swipes or when scrolling vertically with a diagonal swipe.
Keep in mind that slideout will immediately snap the panel to this position. So, if you were to set a high value here, not only would it require a large swipe for the user to see indication of the slideout feature, but it would also mean that you would lose some of the smoothness of the opening effect.
During touchmove events, vertical dragging should be detected to eliminate any cases of unwanted Slidemenu open/close events.