Similar to the site snapping demand, there will be a time countdown display (days, hours, minutes, seconds)
To get the final time compared to the current time, calculate the difference and execute it in seconds with the timer
Implementation code:
$ (document). Ready (function () {run (enddate);});//Timerfunction Run (enddate) {//if EndDate is the date type passed in in the background, this translates directly to the number of millisecondsEnddate=NewDate (Eddate.replace ("T", ""). GetTime ()); //executes at 500 milliseconds (avoids slow execution of the method, which can affect the presentation) 0var time = 500; SetInterval ("Datedif ('" +enddate+ "')", time);}//Calculation Time Differencefunction Datedif (enddate) {var date= EndDate-NewDate (). GetTime (); var days= Date/1000/60/60/24; var daysround=Math.floor (days); var hours= DATE/1000/60/60-(24 *daysround); var hoursround=Math.floor (hours); var minutes= DATE/1000/60-(* * daysround)-(60 *hoursround); var minutesround=Math.floor (minutes); var seconds= date/1000-(* * * daysround)-(60 * hoursround)-minutesround); var secondsround=Math.floor (seconds); var time= "Countdown" + (daysround+ "Day" +hoursround + "+minutesround+" minute "+secondsround+" seconds "); $("#ytime"). Text (time); }
You will get a similar effect as follows:
jquery Calculates the time difference (days, hours, minutes, seconds) and uses the timer to get