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

PreventDefault on touch but not on mouse #2

Open
Macgyverman opened this issue Aug 13, 2013 · 0 comments
Open

PreventDefault on touch but not on mouse #2

Macgyverman opened this issue Aug 13, 2013 · 0 comments

Comments

@Macgyverman
Copy link

We've run into an issue where we need to prevent default on a touch, as the iphone will then trigger a mouse event too, thereby duplicating everything.

I've modified the library to include a configuration option called preventTouchDefault and preventMouseDefault.

And added the folllwing lines of code to replace

Original code:

if (options.preventDefault) {
event.preventDefault && event.preventDefault();
return false;
}

New code

isMouse=false;
if(event.type.match(/^mouse/))
isMouse=true;

            // prevent default handlers
            if ((options.preventTouchDefault && !isMouse) || (options.preventMouseDefault && isMouse)) {
                event.preventDefault && event.preventDefault();
                return false;
            }
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

1 participant