- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 jQuery FlipClock显示给定日期时间的倒计时器。因此,为了在 FlipClock 中显示给定日期和时间的倒计时器,我得到了 this关联。 就我而言,结束日期是
8th December 2015, 12:0:0
因此,根据上面的链接,我编写了这样的代码
var date = new Date(Date.UTC(2015, 12, 8, 12, 0, 0));
var now = new Date();
var diff = date.getTime()/1000 - now.getTime()/1000;
var clock;
clock = $('.clock').FlipClock({
clockFace: 'DailyCounter',
autoStart: false,
callbacks: {
stop: function() {
$('.message').html('The clock has stopped!')
}
}
});
clock.setTime(diff);
clock.setCountdown(true);
clock.start();
<div class="clock"></div>
但是它显示的倒计时日期是错误的。那么我可以知道为什么我会收到此错误吗?如何解决问题?任何建议或意见都非常值得赞赏。谢谢
这是我的 fiddle链接
最佳答案
问题是因为 Date.UTC
中的月份是从零开始的
var date = new Date(Date.UTC(2015, 11, 8, 12, 0, 0)); //11 for Dec
请参阅文档 ( http://www.w3schools.com/jsref/jsref_utc.asp )
month : Required. An integer representing the month Expected values are 0-11, but other values are allowed:
-1 will result in the last month of the previous year
12 will result in the first month of the next year
13 will result in the second of the next year
关于javascript - FlipClock 倒计时器显示给定日期和时间错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34116322/
我正在尝试在我的网站上设置 Flipclock.js,但无论我做什么它似乎都没有加载,chrome 给了我以下错误: 未捕获类型错误:无法调用 null 的方法“FlipClock” 我的代码布局如下
我正在使用 FlipClock.js 开发一个从 1:00 分钟到 0 的简单倒计时器,我的问题是,它不会计数到 0,然后当它重置时,它应该从 00:59 开始是 1:00。我不知道为什么,但在 00
如何在时间结束后重新启动 flipclock? var clock; $(document).ready(function() { clock = new FlipClock($('.cloc
我试图在不重置刷新时间的情况下进行倒计时。我只需要倒计时 1 小时,但我不希望它在刷新时重置。从服务器获取当前时间和过期时间不起作用,因为我想通过单击重置该计时器。这是我当前的 js 代码:
我在我的网站上添加了一个翻转时钟倒计时计时器,我想要一种每分钟触发一个事件的方法,以便我可以对源中的元素进行更改。我尝试在代码中添加一个警报以查看是否触发了回调,但我很确定我不太了解回调方法的文档。我
我正在使用 jQuery FlipClock显示给定日期时间的倒计时器。因此,为了在 FlipClock 中显示给定日期和时间的倒计时器,我得到了 this关联。 就我而言,结束日期是 8th Dec
我正在尝试在 7 个不同的 Raspberry Pis 上获取事件监视器。他们都获得了加载了 FlipClock 的相同网页。 我的问题是:RasPis 上的时间不同。 (他们无法获得实际的 ptb-
我正在尝试集成flipclock网页上的计时器,将倒计时到明天中午 12 点。 让它工作后,当计时器少于一天、一小时一分钟时,我想分别隐藏天、小时和分钟 FIDDLE var date = new
我正在使用FlipClock 1.1a我想在倒计时结束时设置图像并隐藏计数器。目前,当时间到时,计数器会进入 - 时间(-1 小时,-12 分钟)。我怎样才能做到这一点?该网站的回调很少,而且没有帮助
我想为 flipclock 添加一个年计数器,但“天”似乎是现成支持的最大单位。 如何修改以将年份添加为显示计数器之一? 最佳答案 对于任何感兴趣的人,我将以下内容添加到 flipclock.js 中
我正在尝试使 FlipClock JS 倒计时到此标记中指定的日期: (jQuery)(document).ready(function() { clocks.push((j
我正在与 Flipclock 作斗争 http://flipclockjs.com/ 。我浏览了他们的网站,但找不到有关如何更改时间的提示。 我想要做的是设置我想要显示的时间。问题是某些智能电视上的浏
我的 Flipclock 在我的网站上运行良好,但我需要将“天:小时:分钟:”文本更改为白色,但找不到要添加/修改的 css 另外(我使用的是 bootstrap3)我不能让 Flipclock 居中
所以我已经设置了 Flipclock,它可以正常工作,但没有按我希望的方式工作 这是代码: endtimeYear: 0, endtimeMonth: 0, endti
我有一个使用 flipclock.js 的网站。我在将它变大时遇到了一些麻烦,因此它在页面上占用了更多空间。 有谁知道如何放大或扩大它? 最佳答案 添加这个 sass,你就完成了.... .count
我有一个 FlipClock.js在除 iPhone 以外的所有设备和浏览器中完美显示的页面上。 在 iPhone(4、4S、5、6)上,它用数字填充滚动标签,如下图所示。 有没有人遇到过这个,也许可
我想在初始化 FlipClock 时从 HTML 元素获取一个属性。请不要在页面中存在多个 FlipClock 对象。时钟的 HTML 标记是: 如何在“init”回调函数中获取“2015-09-
我正在使用flipclock,我想在其上设置东部时间。我该如何做到这一点?我已放置了 moment.js,我可以使用它来获取当前的东部时间。但问题是,我不知道要向 flipclock 对象的 setT
我正在使用 Justin Kimbrell FlipClock.js(来自 Flipclockjs.com),如下所示: $(function(){ FlipClock.Lang.Custom
我需要 Flipclock.js 方面的帮助,我对 Jquery 一无所知,这个插件快把我逼疯了。我只需要将日期更改为 2014 年 11 月 23 日下午 6 点,但我似乎无法弄清楚这一点。 这是我
我是一名优秀的程序员,十分优秀!