1

プログレスバーに追加機能が実行されるたびに、5 秒のカウントダウンタイマーが終了するたびに 10 を追加する必要があるときに、Cookie の値が 2 倍になります。

追加後に設定したときにCookieの値が2倍になる理由を誰でも指摘できますか。

<script>
    $(document).ready(function () {
        function startContdown() {
            var fiveSeconds = new Date().getTime() + 5000;
            $('#clock').countdown(fiveSeconds, { elapse: true })
                .on('update.countdown', function (event) {
                    if (event.elapsed) {
                        $('#clock').text("countdown ended");
                        addToProgressBar(Cookies.get("test"))
                        startContdown()
                    }
                    else {
                        var $this = $(this);
                        $this.html(event.strftime('Will refresh in <span>%S</span> seconds '))
                    }
                });
        }
        function addToProgressBar(val1) {
            cookieValue = Number(val1) + 10;
            Cookies.set("test", cookieValue);
            $('#progress1').animate({
                'width': (cookieValue)
            }, 100);

            $({ counter: 1 }).animate({ counter: cookieValue / 500 * 100 }, {
                duraton: 100,
                step: function () {
                    $('#progress1').text(Math.ceil(this.counter) + ' %');
                }
            })
        }
        Cookies.set("test", 0);
        startContdown()
    });
</script>
4

0 に答える 0