document.addEventListener('DOMContentLoaded', function(){
var counters=document.querySelectorAll('[id^="persian-counter-"]');
counters.forEach(function(counter){
var target=parseInt(counter.getAttribute('data-target'), 10);
var currentValue=Math.floor(0.8 * target);
function updateCounter(){
if(currentValue <=target){
counter.innerText=toPersianNumbers(currentValue.toString());
currentValue++;
setTimeout(updateCounter, 100);
}}
updateCounter();
});
function toPersianNumbers(number){
const persianDigits=['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'];
return number.replace(/\d/g, digit=> persianDigits[digit]);
}});