2012-12-13 35 views

回答

2
document.getElementById('element').ontouchmove = function (e) { 
    this.ontouchmove = null; 

    // Do something here. 
}; 
+0

是否設置爲null防止它再次燒製過的元素? – jamis0n

+0

謝謝,這是我需要的。 – user984003

+0

@ jamis0n,我只是簡單的替換了被調用的函數,一旦even被null觸發。 – rmobis

0

設置一個布爾值,第一次執行後假,這將在每次函數運行前應檢查:

var doTouchEvent = true; 
document.getElementById('element').ontouchmove = function (e) 
{ 
    if(doTouchEvent){ 
     DISABLE HERE 
     do something that should only happen once 


     doTouchEvent = false; 
    } 
}; 
相關問題