Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does this plugin always prevent the default action? #1

Closed
Sigma-90 opened this issue Mar 26, 2014 · 2 comments
Closed

Why does this plugin always prevent the default action? #1

Sigma-90 opened this issue Mar 26, 2014 · 2 comments

Comments

@Sigma-90
Copy link

I think it is quite problematic that it isn't possible to choose whether the default swipe action should be prevented or not. What if I want to listen to the swipedown event on the document element to hide the mobile navigation when the user scrolls down? What about parallax scrolling for touch devices, where the scroll/swipe event is used to check the current scrolltop and load or modify content based on the page offset? At the moment all this is not possible, as the plugin prevents regular scrolling completely. The touchWipe plugin, which this one claims to be based upon, considered this and offers the preventDefaultEvents parameter. It would be really great if this plugin would not prevent everything by default, but would leave it to each actual event Listener to stop the event from bubbling up further or not, using proper jQuery syntax like this:

$(document).on('swipedown',  function(event){ event.preventDefault(); /* ... */ });

This would just feel natural to any jQuery developer and opens up lots of possibilities where there were serious limitations before.

Best regards,
Stefan

@marcandre
Copy link
Owner

Thanks for the feedback.
I've added a config option. I'm afraid it's an all or nothing thing though, as there's no way to know in advance where the swipe is going.
So, if you don't want to always prevent the default move action, you can use the config option. Note that to prevent it manually, you have to write $(document).on('touchmove',... (not swipedown).

@marcandre
Copy link
Owner

PS: Let me know if that doesn't solve your problem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants