jQuery倒数计时器-倒数到每个月的月底,首先开始吗? [英] jQuery countdown timer - countdown to end of each month, starting first?

查看:92
本文介绍了jQuery倒数计时器-倒数到每个月的月底,首先开始吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

客户希望从每月的第一天开始计算其每月销售的倒计时(服务器时间=当地时间=应该使用的时间),并将其倒计时到月底(28天7)小时(仅剩6分钟).背后的逻辑如何?是否有库/插件默认执行此操作?

A client wants to have a countdown for his monthly sale, starting on the first of each month (server time = local time = time that should be used), and have it countdown till the end of the month (28 days 7 hours 6 minutes remaining). How would the logic behind this look like? Is there a library/plugin that does this by default?

任何指向正确方向的指针都将是惊人的.

Any pointers in the right direction would be amazing.

推荐答案

您必须检查一下,我认为这是您所需要的:

You must check this, I think it's what you need:

http://keith-wood.name/countdown.html

更新

这是您需要的代码:

    <head>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
        <script src="jquery.plugin.js"></script>
        <script src="jquery.countdown.js"></script>
        <script>
            $(function () {
                var date = new Date();
                date = new Date(date.getFullYear(), date.getMonth() + 1, 1);
                $('#defaultCountdown').countdown({until: date});
            });
        </script>
    </head>

    <body>
        Time left:
        <div id="defaultCountdown"/>        
    </body>

这篇关于jQuery倒数计时器-倒数到每个月的月底,首先开始吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆