admin管理员组文章数量:1023744
There are instructions to configure (and how to use) this plugin here: .html
Initialize the countdown timer and set the start time, end time and current time in the javascript.
$('.countdown').final_countdown({ start: '1362139200', end: '1388461320', now: '1387461319' });
First off, I don't know what those numbers mean... it's not even explained. I deduce they mean seconds.
So I set my code this way:
$('.countdown').final_countdown({
'start': 0, /* ((((Jan + Feb + 3 days) * number of hours in a day) * number of minutes in an hour) * number of seconds in a minute) = total seconds */
'end': ((((31+28+31+2)*24)*60)*60), /* started at 9:25 pm on March 03 */
'now': ((((31+28+3)*24)*60)*60),
seconds: {
borderColor: '#8ef58e',
borderWidth: '9'
},
minutes: {
borderColor: '#ff8d72',
borderWidth: '9'
},
hours: {
borderColor: '#69ccff',
borderWidth: '9'
},
days: {
borderColor: '#ffd35c',
borderWidth: '9'
}
});
The problem is that every time one loads the page, it shows the same 29 days. The script is not grabbing the current time/date and paring with another time/date in the future.
So it looks okay now (29 days), but a few days from now someone will load this page and it will be totally off.
You can see the script (and issue) here:
I greatly appreciate any help on this.
There are instructions to configure (and how to use) this plugin here: http://www.jqueryscript/time-clock/Modern-Circular-jQuery-Countdown-Timer-Plugin-Final-Countdown.html
Initialize the countdown timer and set the start time, end time and current time in the javascript.
$('.countdown').final_countdown({ start: '1362139200', end: '1388461320', now: '1387461319' });
First off, I don't know what those numbers mean... it's not even explained. I deduce they mean seconds.
So I set my code this way:
$('.countdown').final_countdown({
'start': 0, /* ((((Jan + Feb + 3 days) * number of hours in a day) * number of minutes in an hour) * number of seconds in a minute) = total seconds */
'end': ((((31+28+31+2)*24)*60)*60), /* started at 9:25 pm on March 03 */
'now': ((((31+28+3)*24)*60)*60),
seconds: {
borderColor: '#8ef58e',
borderWidth: '9'
},
minutes: {
borderColor: '#ff8d72',
borderWidth: '9'
},
hours: {
borderColor: '#69ccff',
borderWidth: '9'
},
days: {
borderColor: '#ffd35c',
borderWidth: '9'
}
});
The problem is that every time one loads the page, it shows the same 29 days. The script is not grabbing the current time/date and paring with another time/date in the future.
So it looks okay now (29 days), but a few days from now someone will load this page and it will be totally off.
You can see the script (and issue) here: http://www.3rd-dimension.co
I greatly appreciate any help on this.
Share Improve this question asked Mar 4, 2015 at 5:58 Ricardo ParkerRicardo Parker 8191 gold badge9 silver badges10 bronze badges2 Answers
Reset to default 3The problem is that your 'now' value is a fixed value (eg. 'now': ((((31+28+3)*24)*60)*60),
).
Instead, you should get your 'now' value dynamically, with JavaScript's native new Date()
, as shown below:
// We will get the "now" value from this variable
var today = new Date();
// My target date is this month 30th 9.25pm
var target = new Date(today);
target.setDate(30);
target.setHours(21,25,0,0);;
// Countdown start from yesterday
var yesterday = new Date(today);
yesterday.setDate(today.getDate() - 1);
yesterday.setHours(0,0,0,0);;
$('.countdown').final_countdown({
'start': yesterday.getTime() / 1000,
'end': target.getTime() / 1000,
'now': today.getTime() / 1000,
seconds: {
borderColor: '#8ef58e',
borderWidth: '9'
},
minutes: {
borderColor: '#ff8d72',
borderWidth: '9'
},
hours: {
borderColor: '#69ccff',
borderWidth: '9'
},
days: {
borderColor: '#ffd35c',
borderWidth: '9'
}
});
Please refer to fiddle for working example: http://jsfiddle/zeskysee/v0hc6cfj/11/
Hope this help :)
<script type="text/javascript">
$('document').ready(function () { var end = Math.floor((new Date("02/11/2018")).getTime() / 1000);
var start = Math.floor((new Date("01/23/2018")).getTime() / 1000);
var now = Math.floor((new Date).getTime() / 1000);
$('.countdown').final_countdown({
'start': start,
'end': end,
'now': now
});
});
There are instructions to configure (and how to use) this plugin here: .html
Initialize the countdown timer and set the start time, end time and current time in the javascript.
$('.countdown').final_countdown({ start: '1362139200', end: '1388461320', now: '1387461319' });
First off, I don't know what those numbers mean... it's not even explained. I deduce they mean seconds.
So I set my code this way:
$('.countdown').final_countdown({
'start': 0, /* ((((Jan + Feb + 3 days) * number of hours in a day) * number of minutes in an hour) * number of seconds in a minute) = total seconds */
'end': ((((31+28+31+2)*24)*60)*60), /* started at 9:25 pm on March 03 */
'now': ((((31+28+3)*24)*60)*60),
seconds: {
borderColor: '#8ef58e',
borderWidth: '9'
},
minutes: {
borderColor: '#ff8d72',
borderWidth: '9'
},
hours: {
borderColor: '#69ccff',
borderWidth: '9'
},
days: {
borderColor: '#ffd35c',
borderWidth: '9'
}
});
The problem is that every time one loads the page, it shows the same 29 days. The script is not grabbing the current time/date and paring with another time/date in the future.
So it looks okay now (29 days), but a few days from now someone will load this page and it will be totally off.
You can see the script (and issue) here:
I greatly appreciate any help on this.
There are instructions to configure (and how to use) this plugin here: http://www.jqueryscript/time-clock/Modern-Circular-jQuery-Countdown-Timer-Plugin-Final-Countdown.html
Initialize the countdown timer and set the start time, end time and current time in the javascript.
$('.countdown').final_countdown({ start: '1362139200', end: '1388461320', now: '1387461319' });
First off, I don't know what those numbers mean... it's not even explained. I deduce they mean seconds.
So I set my code this way:
$('.countdown').final_countdown({
'start': 0, /* ((((Jan + Feb + 3 days) * number of hours in a day) * number of minutes in an hour) * number of seconds in a minute) = total seconds */
'end': ((((31+28+31+2)*24)*60)*60), /* started at 9:25 pm on March 03 */
'now': ((((31+28+3)*24)*60)*60),
seconds: {
borderColor: '#8ef58e',
borderWidth: '9'
},
minutes: {
borderColor: '#ff8d72',
borderWidth: '9'
},
hours: {
borderColor: '#69ccff',
borderWidth: '9'
},
days: {
borderColor: '#ffd35c',
borderWidth: '9'
}
});
The problem is that every time one loads the page, it shows the same 29 days. The script is not grabbing the current time/date and paring with another time/date in the future.
So it looks okay now (29 days), but a few days from now someone will load this page and it will be totally off.
You can see the script (and issue) here: http://www.3rd-dimension.co
I greatly appreciate any help on this.
Share Improve this question asked Mar 4, 2015 at 5:58 Ricardo ParkerRicardo Parker 8191 gold badge9 silver badges10 bronze badges2 Answers
Reset to default 3The problem is that your 'now' value is a fixed value (eg. 'now': ((((31+28+3)*24)*60)*60),
).
Instead, you should get your 'now' value dynamically, with JavaScript's native new Date()
, as shown below:
// We will get the "now" value from this variable
var today = new Date();
// My target date is this month 30th 9.25pm
var target = new Date(today);
target.setDate(30);
target.setHours(21,25,0,0);;
// Countdown start from yesterday
var yesterday = new Date(today);
yesterday.setDate(today.getDate() - 1);
yesterday.setHours(0,0,0,0);;
$('.countdown').final_countdown({
'start': yesterday.getTime() / 1000,
'end': target.getTime() / 1000,
'now': today.getTime() / 1000,
seconds: {
borderColor: '#8ef58e',
borderWidth: '9'
},
minutes: {
borderColor: '#ff8d72',
borderWidth: '9'
},
hours: {
borderColor: '#69ccff',
borderWidth: '9'
},
days: {
borderColor: '#ffd35c',
borderWidth: '9'
}
});
Please refer to fiddle for working example: http://jsfiddle/zeskysee/v0hc6cfj/11/
Hope this help :)
<script type="text/javascript">
$('document').ready(function () { var end = Math.floor((new Date("02/11/2018")).getTime() / 1000);
var start = Math.floor((new Date("01/23/2018")).getTime() / 1000);
var now = Math.floor((new Date).getTime() / 1000);
$('.countdown').final_countdown({
'start': start,
'end': end,
'now': now
});
});
本文标签: javascriptjqueryfinalcountdownjsneed help configuring itStack Overflow
版权声明:本文标题:javascript - jquery.final-countdown.js - need help configuring it - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745584035a2157474.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论