我尝试使用YUI 3在“后退”按钮上分离'touchstart'元素。
但没有什么是分离的。当我触摸“后退”按钮时,两个函数都被调用。
这是我的代码:
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();
});
答案 0 :(得分:0)
好的,我找到了。
您可以仅为您正在使用的Y元素分离事件。
我使用了全局元素
YEvent = YUI().use('node','touch-event');
现在我在YEvent元素上创建了detach()和on(),它正在工作。