前端让数字滚动

前端让数字滚动

$('.类名').each(function(){
    
    
			let number = parseFloat($(this).text()).toFixed(1);
			let toFixed = 0;
			if(number.substr(number.length-2,number.length) != ".0"){
    
    
				toFixed = 1;
			}

			$(this).prop('Counter',0).animate({
    
    
				Counter: $(this).text()
			},{
    
    
				duration: 2000,
				easing: 'swing',
				step: function (now){
    
    
					$(this).text(now.toFixed(toFixed));
				}
			});
		});

猜你喜欢

转载自blog.csdn.net/weixin_42947972/article/details/127248750