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

Stopping a link doesn't seem to work #2

Closed
bryannielsen opened this issue Aug 29, 2012 · 3 comments
Closed

Stopping a link doesn't seem to work #2

bryannielsen opened this issue Aug 29, 2012 · 3 comments
Assignees
Labels
question The issue actually contains a general question about the library, its use or deployment.

Comments

@bryannielsen
Copy link

Doing something like -

$('a.someclass').live('singletap', function(e) {
    //some code
    e.preventDefault();
    return false;
});

Doesn't seem to have any effect on canceling out the page redirect. This particular test I did was using jQuery 1.7.2

@benmajor
Copy link
Owner

Actually, the library is functioning correctly. In the case of the singletap event, the event returned is the end function (i.e. mouseup for desktop devices, and touchend for mobile and touch devices). If you want to prevent the anchor element's default behaviour (i.e. changing the navigator's location), use something like this alongside:

$('a.somclass').live('click', function(e) { e.preventDefault() });

Remember that singletap is not a pseudonym for click!

@ghost ghost assigned benmajor Aug 31, 2012
@bryannielsen
Copy link
Author

That makes perfect sense, thanks for clearing that up Ben!

@benmajor
Copy link
Owner

benmajor commented Sep 6, 2012

Glad I could, Bryan. Hope you have some fun using the library!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question The issue actually contains a general question about the library, its use or deployment.
Projects
None yet
Development

No branches or pull requests

2 participants