滚动一次时如何运行jquery countTo
插件?
$(window).scroll(function(){
$(".fact-to:in-viewport").countTo({
speed: 500,
refreshInterval: 2
});
});
答案 0 :(得分:1)
添加标志:
var countFlag = false;
$(window).scroll(function(){
if(!countFlag) {
countFlag = true;
$(".fact-to:in-viewport").countTo({
speed: 500,
refreshInterval: 2
});
}
});