ready = ->
onPan = (ev) ->
console.log(ev)
# ev.target.dataset.object
createHammer = (v) ->
mc = new Hammer.Manager(v, {})
mc.add new Hammer.Pan(
direction: Hammer.DIRECTION_HORIZONTAL
threshold: 20
)
mc.on 'panleft', onPan
mc.on 'panright', onPan
selector = '.foo a'
createHammer(v) for v in document.querySelectorAll(selector)
$(document).ready(ready)
$(document).on('page:load', ready)
I don't know what I'm doing wrong, here... the objects all get a handler, and when I drag 's (mind you, with my mouse on my computer) if I stop on the element, it clicks. The last hammer event's srcEvent.type
is mousemove, so it's not hammer firing the event. I tried calling ev.preventDefault()
, but didn't seem to have any effect.
I still want to be able to click the ... just not after a drag. What am I missing?
I tried preventDefault: true
as an option on the manager...
I tried ev.preventDefault()
on the action...
I had the same problem, fixed it by temporarily (200ms) disabling click-handling on the target element. This was done in the panend event by setting a flag and starting a timer to remove that flag