我想将倒数计时器设置为在24小时后结束。这是我到目前为止用于计时器的代码:
countdown: {
// Possible options are 'default' or 'piechart'
type: 'default',
// The date when the countdown started. Used by the progress bars. 24 Hour format (00 to 23): Month Day, Year Hours:Minutes
startDate: new Date(),
// The target date we're counting down to. 24 Hour format (00 to 23): Month Day, Year Hours:Minutes
targetDate: new Date("startDate"+1)
},
最初,模板附带的代码是;
countdown: {
// Possible options are 'default' or 'piechart'
type: 'default',
// The date when the countdown started. Used by the progress bars. 24 Hour format (00 to 23): Month Day, Year Hours:Minutes
startDate: new Date("November 1, 2013 00:00"),
// The target date we're counting down to. 24 Hour format (00 to 23): Month Day, Year Hours:Minutes
targetDate: new Date("July 20, 2014 11:13")
},
我希望倒计时每天开始,并在24小时后结束,这就是为什么我删除了开始日期的日期。任何帮助,将不胜感激。感谢。
答案 0 :(得分:1)
var startDate = new Date();
var endDate = new Date();
endDate.setDate(startDate.getDate() + 1);
var countdown = { startDate: startDate, targetDate: endDate };