누적 방문자 수

205

고객 만족도

99%

<script>

function countUp(id, endValue, duration) {

  let current = 0;

  const increment = endValue / (duration / 16); // 대략 60fps 기준


  const obj = document.getElementById(id);

  const counter = setInterval(() => {

    current += increment;

    if (current >= endValue) {

      current = endValue;

      clearInterval(counter);

    }

    obj.innerText = Math.floor(current);

  }, 16); // 약 60fps

}


// 페이지 로드 후 실행

window.addEventListener('DOMContentLoaded', () => {

  countUp('count1', 205, 1000); // 1초 동안 205까지

  countUp('count2', 99, 1000);  // 1초 동안 99까지

});

</script>