开发者

How to get the let time from a jquery coutdown

I'm new in jquery and I set a countdown time. Below that it is a question and answers.I want get the left time when user choose the answer,how can I do that?Thanks PS:I searched and found something called curvyCorners which said to be easier to get the left time ,but I don't know that

$(function() {
    var newYear = new Date();
    newYear = new Date(newYear.getFullYear() + 1, 1 - 1, 1);

    $('#defaultCountdown').countdown({
        until: +30,
        compact: true,
        format: 'MS'
    });

    $('#getNow').click(function() {
        var开发者_运维知识库 periods = $('#curvyCorners').countdown('getTimes');
        var text = '';
        for (var i = 0; i < periods.length; i++) {
            text += periods[i] + '' + $.countdown.regional[''].labels[i] + '';
        }

        $('#curPeriods').text(text);
    });

    $('#removeCountdown').toggle(function() {
            $(this).text('Re-attach');
            $('#defaultCountdown').countdown('destroy');
        },
        function () {
            $(this).text('Remove');
            $('#defaultCountdown').countdown({
                until: +30
            });
        }
    );
});


You can use the following method:

$(selector).countdown('getTimes');

It will return a number[7] array which entries are years, months, weeks, days, hours, minutes and seconds.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜