This example make use of jquery.hammer.js for implementing delegated events for inner elements. Just like what we did in the TouchSwipe Example.
<!doctype html> <html> <head> <title>Eureka! - hammer.js Example</title> <style type="text/css"> .box { background-color: red; width: 400px; height: 50px; line-height: 50px; text-align: center; list-style: none; margin-bottom: 10px; } </style> </head> <body> <ul id="boxes"> <li class="box">Old box</li> <li class="box">Old box</li> <li class="box">Old box</li> </ul> <button id="add">Add box</button> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script type="text/javascript" src="js/hammer.js"></script> <script type="text/javascript" src="js/jquery.hammer.min.js"></script> <script type="text/javascript"> $("#add").click(function(){ $("#boxes").append('<li class="box">New box</li>'); }); var hammertime = $("#boxes").hammer(); hammertime.on("swipeleft", ".box", function(event) { $(this).text("You swiped left" ); }); hammertime.on("swiperight", ".box", function(event) { $(this).text("You swiped right" ); }); </script> </body> </html>
Done =)
Reference: