添加媒体查询

时间:2017-06-30 11:21:36

标签: javascript jquery html media-queries

我想让我的countdown timer responsive in mobile view 我想让它在移动设备中做出响应,这样它应该像列表 {{1 }} 怎么做?

jsfiddle

days ,hours,min,seconds

1 个答案:

答案 0 :(得分:0)

根据我的理解,您要求,如何计算今天和FinalDay之间的时差?

var today = new Date();
var FinalDay = new Date("7-01-2017 18:00");
var milliSecondsRemaining = (FinalDay - today); // milliseconds between now & FinalDay
var daysRemaining = Math.floor(milliSecondsRemaining / 86400000); // days
var hoursRemaining = Math.floor((milliSecondsRemaining % 86400000) / 3600000); // hours
var minutesRemaining = Math.round(((milliSecondsRemaining % 86400000) % 3600000) / 60000); // minutes
alert("Registration Closes In" + daysRemaining + " Days, " + hoursRemaining + " Hours, " + minutesRemaining + " Minutes");

希望这能解决你的问题。