Monday, 9 September 2013

hammer.js - different swipe handlers on parent and child nodes

hammer.js - different swipe handlers on parent and child nodes

I use hammer.js to bind swipe event handlers (while this is also a basic
jquery problem).
<div id="container">
...
<div id="entry">Swipe to delete this entry.</div>
...
</div>
If user swipe on the entry div, I want to add a line through it. If the
user swipe on other area of the container div (the srcElement may be other
child elements), I want to fold the container. How can I implement this
elegantly (now I bind a swipe handler to the container and check if
event.target is not the entry div, but this won't work if there are many
entries.)

No comments:

Post a Comment