我已经在jQuery中创建了一个倒数计时器,但是我不知道如何对其进行样式设置。我想按照所附图像对其进行编码。
FIDDLE
jQuery的:
// update the tag with id "countdown" every 1 second
setInterval(function () {
// find the amount of "seconds" between now and target
var current_date = new Date().getTime();
var seconds_left = (target_date - current_date) / 1000;
// do some time calculations
days = parseInt(seconds_left / 86400);
seconds_left = seconds_left % 86400;
hours = parseInt(seconds_left / 3600);
seconds_left = seconds_left % 3600;
minutes = parseInt(seconds_left / 60);
seconds = parseInt(seconds_left % 60);
// format countdown string + set tag value
countdown.innerHTML = days + "d, " + hours + "h, "
+ minutes + "m, " + seconds + "s";
}, 1000);
最佳答案
http://jsfiddle.net/456jn/44/
CSS:
Javascript:
关于javascript - 在jQuery中设置倒数计时器的样式,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22267662/