On my Android phone (2.1), I observe strange behavior with setTimeout, when on the finger we press the touch screen for a while.
This very simple code actually works fine (1 call every second) until I scroll for a while (2-3 seconds is enough) when it stops being called
$(document).ready(function(){ spam(); }); function spam(){ console.log("cia") setTimeout(spam, 1000); }
I have the same problem.
The solution was for me to define the called function as a variable, than pass ist as a parameter to setTimeout.
Try the following:
var spam = function(){ console.log("cia") setTimeout(spam, 1000); } $(document).ready(function(){ spam(); });
I had this problem on my device when I was doing some kind of development, but none of these solutions worked for me.
, , , , .
, , . , , , . , , .
: - , ( setTimeout(), setInterval() , javascript ).
Samsung Galaxy S Android 2.1, , - , , .
try it
function spam(){ console.log("cia") setTimeout("spam()", 1000); }
SetTimeout:
/** @param {String|Function} vCode @param {Number} iMillis @return Number */ window.setTimeout = function(vCode,iMillis) {};
For me, Varriotts answer did not work ... the only way to get setTimeout to work on the Android phone that I used for testing (works v 2.something) is the following notation:
function foo() {} window.setTimeout(foo, 200);
It looks weird, passing only the name of the function, but after several hours of trying, it was the only way it worked.
I tried this and it solved my problem.
setTimout(function(){aFunction(text);}, 200);
Source: https://habr.com/ru/post/1759788/More articles:Apple iOS tutorial not working correctly, what did I miss? - iphoneDo JavaScript compilers have a preference for how indents, spaces, and curly braces are placed in the source code? - javascriptUnable to use git with aptana - gitPython module issues - pythonProbabilistic clustering methods for similar text data? - text-processingWCF Data Border Design - .netSolr How to delete all EXCEPT entries in an array? - htmlSetting the default option for Zend_Form_Element_Select - phpZend_Form_Element_Multi element definitionSelect an element - zend-frameworkAndroid Tabs & Intents - androidAll Articles