How do you delegate events in hammer.js version 2.0?
|September 13, 2014||Posted by forumadmin under TechQns||
In hammer.js v1.x (with jquery plugin) you could delegate events like this:
$('ul').hammer().on("touch", "li", callback);
With this syntax, you could attach the event listener to the
ul instead of the individual
li elements that you wanted to listen to. This would allow you to dynamically add
li elements to the
ul without reattaching event listeners.
However I can’t figure out how to do it in Hammer v2.0. (I’ve changed
tap per the new syntax).
|Asked By – dadThrowsBolts||Read Answers|