GianlucaGuarini / Tocca.js

Super lightweight script (~1kb) to detect via Javascript events like 'tap' 'dbltap' 'swipeup' 'swipedown' 'swipeleft' 'swiperight' on any kind of device.
http://gianlucaguarini.github.io/Tocca.js/
MIT License
660 stars 60 forks source link

event.preventDefault() not working with jQuery #49

Closed kimasendorf closed 6 years ago

kimasendorf commented 7 years ago

I am using Backbone router which makes it neccesary to preventDefault on hyperlinks. When I change 'tap' to 'click' it works like expected.

$(document).on('tap', 'a.bb', function(event) {
    event.preventDefault();

    console.log('CLICK');
    var href = $(this).attr('href');
    Backbone.history.navigate(href, true);
});
GianlucaGuarini commented 7 years ago

You can use e.originalEvent.preventDefault() I guess

kimasendorf commented 7 years ago

Nope, I tried that..

GianlucaGuarini commented 6 years ago

i am closing this issue because there is no default behavior for tocca events so prevent default doesn't make really sense