I am working on a Javascript / html5 project for iPad.
I need to be able to catch touchmove events on an element that does not get added to the DOM
until after a touchstart
event has fired (i.e. until after a person has put their finger on the screen.)
I have tried simulating a touchstart
event and firing it programatically...
$( "#container" ).append( element );
element.on( "touchmove", doStuff );
var ev = $.Event( "touchstart" );
element.trigger( ev );
...however this does not work. The only way I can get doStuff
to start firing is to lift my finger and then touch the screen again, triggering a second touchstart
event.
How can I catch touchmove
events on an element that is added to the DOM
after my finger is already on the screen?