I try to detach a 'touchstart' element, on a "back" button, with YUI 3.
But nothing is detach. When I touch on the "back" button, both of functions are called.
Here my code :
Y.all('.back').detachAll('touchstart');
Y.all('.back').on('touchstart',function(e){
alert('types');
loadMainframe(myURL);
e.preventDefault();
});
Y.all('.back').detachAll('touchstart');
Y.all('.back').on('touchstart',function(e){
alert('resto');
loadMainframe(myURL);
e.preventDefault();
});
Ok, i found.
You can detach events, only for the Y element that you are using.
I used a global element
YEvent = YUI().use('node','touch-event');
and now i make my detach() and on() on the YEvent element, and it's working.