Mango / slideout

A touch slideout navigation menu for your mobile web apps.
https://slideout.js.org
MIT License
7.94k stars 1.15k forks source link

Prevent triggering open/close events while dragging vertically #99

Open joelray opened 9 years ago

joelray commented 9 years ago

During touchmove events, vertical dragging should be detected to eliminate any cases of unwanted Slidemenu open/close events.

MitchellBouwman commented 9 years ago

+1

a-tarasyuk commented 9 years ago

+1

julianlam commented 9 years ago

+1, this is a constant complaint in our implementation of slideout.js, and having this addressed would complete its functionality for us :smile:

fspoettel commented 9 years ago

+1

rasitozcan commented 7 years ago

+1 It would be nice to have horizontal threshold option.

MitchellBouwman commented 7 years ago

Still no response after almost 2 years. Do people already have alternatives?

dhamaniasad commented 7 years ago

More than two years. This is a major pain too.

dinhtungdu commented 6 years ago

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);
Velora commented 6 years ago

I'd also be interested in hearing if anyone had a better solution for this.

Velora commented 6 years ago

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.