2013-07-31 31 views
-1

我剛剛下載了這個倒計時腳本(JavaScript),但我無法弄清楚如何更改計時器倒計時的日期。 原創劇本:我在哪裏更改倒計時功能的日期?

$(function(){ 
var now = new Date(); 
// comment out the line below and change the date of your countdown here 
var in30Days = new Date(now.getTime() + (30 * 24 * 60 * 60 * 1000)); 
// year to countdown to 
var countdownYear = in30Days.getFullYear(); 
// month to countdown to 0 = Jan, 1 = Feb, etc 
var countdownMonth = in30Days.getMonth(); 
// day to countdown to 
var countdownDay = in30Days.getDate(); 

var countdownDate = new Date(countdownYear, countdownMonth, countdownDay); 

setupCountdownTimer(countdownDate); 

spaceParallax(); 

hideIphoneBar(); 

$("[placeholder]").togglePlaceholder(); 

setupSignupForm(); 
}); 

回答

0

也許倒數日期... 默認情況下它是建立與現在+ 30天呢?你可以改變這一點。

重要的部分是:

setupCountdownTimer(countdownDate); 

spaceParallax(); 

hideIphoneBar(); 

$("[placeholder]").togglePlaceholder(); 

setupSignupForm(); 
}); 
0

你的代碼本身告訴如何做到這一點:

// comment out the line below and change the date of your countdown here 
var in30Days = new Date(now.getTime() + (30 * 24 * 60 * 60 * 1000)); 
// year to countdown to 
var countdownYear = in30Days.getFullYear(); 
// month to countdown to 0 = Jan, 1 = Feb, etc 
var countdownMonth = in30Days.getMonth(); 
// day to countdown to 
var countdownDay = in30Days.getDate(); 

繼行創建了倒數日期,年,月,日傳遞給函數

var countdownDate = new Date(countdownYear, countdownMonth, countdownDay); 

setupCountdownTimer(countdownDate);