第一种方式:
var sh=setInterval(sumCount,1000);
function sumCount() {
try {
debugger;
$('.count'+circle).each(function() {
var value = $(this).text();
console.log(value);
$("#countSumValue").text("");
$("#countSumValue").append(value);
window.clearInterval(sh); //消除 定时器消除
return false; //跳出each循环
});
//clearInteval(sh);
} catch (err) {
console.log(err.name);
console.log(err.message);
}
}
第二种方式:
try {
var sh1=setInterval(function(){
$('.coun'+circle).each(function() {
var value = $(this).text();
console.log(value);
$("#countSumValue").text("");
$("#countSumValue").append(value);
window.clearInterval(sh1); //消除
return false;
});
window.clearInterval(sh1); //消除
},1000);
} catch (err) {
console.log(err.name);
console.log(err.message);
}