2012-12-13 17 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; 
    } 
};