2012-06-01 32 views
1

我嘗試使用YUI 3分離「後退」按鈕上的「touchstart」元素。YUI 3上的分離事件

但是沒有任何分離。當我點擊「後退」按鈕時,兩個功能都會被調用。

這裏我的代碼:

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

好吧,我發現。

只能爲您正在使用的Y元素分離事件。

我用了一個全局元素

YEvent = YUI().use('node','touch-event'); 

,現在我把我的YEvent元素分離()和(),它的工作。