在我的Android手机(2.1),我看到一个奇怪的现象与setTimeout的保持pssed在触摸屏上一会儿手指$ P $的时候。
这很简单code其实工作正常(1调用每秒),直到我滚动了一段时间窗口(2-3秒就足够了),当它不再是所谓的
$(文件)。就绪(函数(){
垃圾邮件();
});
功能垃圾邮件(){
的console.log(CIA)
的setTimeout(垃圾邮件,1000);
}
解决方案
我有同样的问题。
解决的办法是对我定义调用函数作为变量,比IST传递作为参数传递给setTimeout的。
试试这个:
变种垃圾邮件=功能(){
的console.log(CIA)
的setTimeout(垃圾邮件,1000);
}
$(文件)。就绪(函数(){
垃圾邮件();
});
On my android phone (2.1) I'm seeing a strange behavior with setTimeout when keeping a finger pressed on the touchscreen for a while.
This very simple code in fact works fine (1 call each second), until I scroll for a while the window (2-3 seconds are sufficient), when it stops being called
$(document).ready(function(){
spam();
});
function spam(){
console.log("cia")
setTimeout(spam, 1000);
}
解决方案
I has the same Problem.
The solution was for me to define the called function as a variable, than passing ist as parameter to the setTimeout.
Try this:
var spam = function(){
console.log("cia")
setTimeout(spam, 1000);
}
$(document).ready(function(){
spam();
});