이전 목록 다음
채택완료

countup.js 질문

안녕하세요.

countup.js사용시 문제가있어 질문드립니다.

Copy
<script>

$(".count_num").countUp();

</script>

<span class="count_num">123,456,789</span>

이렇게 하면 정상작동 잘되나,

Copy
<script>

$(".btn").click(function(){

 $(".count_num").countUp();

});

</script>

<span class="count_num">123,456,789</span>

<button class="btn">버튼</button>

와 같이 클릭시에 이벤트를 주면 클릭시에는 문제가없으나

더블클릭 or 광클할시 123,456,789의 값이 점점 변형되는데

해결 방법 조언좀 부탁드릴게요 ㅠㅠ

 

|

답변 1개 / 댓글 1개

채택된 답변
+20 포인트

Copy
<script>
$(".btn").click(function(){
    $(this).prop("disabled", true);
    
    $(".count_num").countUp();
    
    setTimeout(function(){
        $(this).prop("disabled", false);
    }, 1000);
});
</script>
<span class="count_num">123,456,789</span>
<button class="btn">버튼</button>

답변에 대한 댓글 1개

선생님! 정말 감사드립니다!^^7

답변을 작성하려면 로그인이 필요합니다.