Добрый день господа гуру веба, возникла вот какая проблема, подключил таймер на сайт и поставил отсчет от 10 дней, но он не отсчитывает как надо. Буду благодарен за помощь в решении или подсказке в какую сторону копать. Чести и удачи!
geekdeveloper.ru/test2<div id="timer" style="position:absolute;top:1024px;margin-left:-22%;left:50%;z-index:999;text-align:left;font-size:30px;color:#000;line-height:22px;font-family: 'Open Sans', sans-serif; width: 100%; min-width: 250px; max-width: 250px;">
<div id="timer_wrap">
<div class="timer" style="display: inline-block;">
<div class="container">
<div class="days" style="float: left;">
<span class="flip day1Play">1</span>
<span class="flip dayPlay">0</span>
<!-- <em> дней</em> -->
</div>
<div class="hours" style="float: left; margin-left: 15px;">
<span class="flip hour2Play">0</span>
<span class="flip hourPlay">0</span>
<!-- <em> часов</em> -->
</div>
<div class="minutes" style="float: left; margin-left: 15px;">
<span class="flip minute6Play">0</span>
<span class="flip minutePlay">0</span>
<!-- <em> минут</em> -->
</div>
<div class="seconds" style="float: left; margin-left: 15px; color: red">
<span class="flip second6Play">0</span>
<span class="flip secondPlay">0</span>
<!-- <em> секунд</em> -->
</div>
</div>
</div>
</div>
</div>
var myDate = new Date();
function returnEndDate(d,h,m){
myDate.setDate(myDate.getDate()+10);
myDate.setHours(myDate.getHours()+00);
myDate.setMinutes(myDate.getMinutes()+00);
myDate.setSeconds(myDate.getSeconds()+00);
return myDate;
}
if($.cookie("")){
var dateEnd = $.cookie("");
}else{
var dateEnd = returnEndDate(0,0,0);
var date = new Date();
date.setTime(date.getTime() + (100*24*60*60*1000));
$.cookie("", dateEnd, {expires: date});
}
var set_slide = function(selector, slide) {
$(selector).text(slide);
}
var time = new Date();
var target_time = new Date(time.getFullYear(), time.getMonth(), time.getDate());
target_time = target_time.valueOf()+1000*60*60*24;
var tick = function(init) {
if (init == undefined) {
init = false;
}
var current_time = new Date();
current_time = current_time.valueOf();
if (current_time > target_time) {
var time = new Date();
target_time = new Date(time.getFullYear(), time.getMonth(), time.getDate());
target_time = target_time.valueOf()+1000*60*60*24;
}
var time_diff = Math.floor((target_time - current_time)/1000);
var second_2 = time_diff % 10; time_diff = Math.floor(time_diff/10);
var second_1 = time_diff % 6; time_diff = Math.floor(time_diff/6);
var minute_2 = time_diff % 10; time_diff = Math.floor(time_diff/10);
var minute_1 = time_diff % 6; time_diff = Math.floor(time_diff/6);
var hour_2 = Math.floor(time_diff/10);
var hour_1 = time_diff % 10;
set_slide('span.secondPlay', second_2);
if ((second_2 == 9) || init) {set_slide('span.second6Play', second_1);
if ((second_1 == 5) || init) {set_slide('span.minutePlay', minute_2);
if ((minute_2 == 9) || init) {set_slide('span.minute6Play', minute_1);
if ((minute_1 == 5) || init) {set_slide('span.hourPlay', hour_1);
if ((hour_2 == 9) || init) {set_slide('span.hour2Play', hour_2);}}}}}
}
tick(true);
setInterval(tick, 1000);