Методы setinterval и settimeout в jQuery
В редакторе
Методы setinterval и settimeout в jQuery
Brain_Script
1032
2016-09-03 15:00:34
var timer = setInterval(function(){
if(someConditionIsTrue){
clearTimeout(timer);
}
},100);
/*But if, due to some reasons, the 'someCondition' never gets true than you need to
clear the timer otherwise it might turn into an infinite loop*/
setTimeout("clearTimeout(timer)",10000) //10 seconds or more
Войдите для добавления комментария.