gpt4 book ai didi

php - 我的时间隐藏不能正常工作

转载 作者:行者123 更新时间:2023-11-28 01:28:24 26 4
gpt4 key购买 nike

嘿,我正在处理时间事件页面,当事件时间结束时,我的事件必须是“显示:无”。但是,例如,在我键入“6:45”之类的内容时,它会显示 op,就好像时间已经过去了一样。

在我的示例中,我将“display: hidden”设置为红色背景,以便更好地供大家使用。

希望您能帮助我找到错误。

function timeit() {
var t = [],
e = new Date;
Date.prototype.yyyymmdd = function() {
var t = this.getMonth() + 1,
e = this.getDate();
return [this.getFullYear(), (t > 9 ? "" : "0") + t, (e > 9 ? "" : "0") + e].join("-")
};
var i = e.yyyymmdd();
if ($(".timeit").each(function() {
function n(i) {
var n = i - e;
864e5 > n && n > 1e3 && t.push(n)
}

function a(t) {
var e, i = /^\s*(\d{4})-(\d\d)-(\d\d)?.(\d\d)?.(\d\d)\s*$/,
n = new Date(NaN);
t.substr(0, t.indexOf(" "));
return parts = i.exec(t), parts && (e = +parts[2], n.setFullYear(parts[1], e - 1, parts[3]), e != n.getMonth() + 1 && n.setTime(NaN), n = new Date(parts[1], e - 1, parts[3], parts[4], parts[5])), n
}

function r(t, n) {
if (t) {
String(t).length < 6 && String(t).indexOf(":") > -1 && (t = i + " " + String(t)), -1 == String(t).indexOf(":") && (t += " 00:00");
var r = t.split(":"),
s = String(r.slice(0, 1)),
d = s.substr(s.length - 2),
o = r.slice(1),
l = 24 > d && 60 > o ? !0 : !1,
u = new Date(t);
if ("Invalid Date" == u) var u = a(t);
return "Invalid Date" != u && l || $(n).addClass("error").attr("title", '"' + t + '" date is incorrect; please use YYYY-MM-DD HH:MM format'), u.getTime()
}
return e.getTime()
}
var s = $(this).data("end"),
d = $(this).data("start"),
o = r(d, this),
l = r(s, this);
n(o), n(l), l > o && (o > e || e > l) || o > l && o >= e && e >= l ? $(this).addClass("hidden") : $(this).removeClass("hidden")
}), t.length > 0) {
var n = Math.min.apply(null, t);
console.log("next run of timeit function is in " + n / 1e3 + "seconds"), setTimeout(function() {
timeit()
}, n)
}
}
timeit();
.hidden {	
background: red;
}
.error {
color: red;
}
.time {
font-weight: bold;
}
.teams {
padding: 3px 0;
}
.league {
font-size: 12px;
margin-bottom: 20px;
}
<!DOCTYPE html>
<html>
<head>
<title>soccertime</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>


<div class="timeit" data-start="2018-7-1 14:00" data-end="2018-7-1 15:01">
<div class="time">TV2 - 14:00</div>
<div class="teams">Spanien - Rusland</div>
<div class="league">FIFA World Cup 2018 - 1/8 finale</div>
</div>

<div class="timeit" data-start="2018-7-1 14:35" data-end="2018-7-1 16:00">
<div class="time">Youtube - 17:35</div>
<div class="teams">SK Sturm Graz - F.C. København</div>
<div class="league">Træningskamp</div>
</div>

<div class="timeit" data-start="2018-7-1 17:35" data-end="2018-7-1 19:00">
<div class="time">DR1 - 19:00</div>
<div class="teams">Kroatien - Danmark</div>
<div class="league">FIFA World Cup 2018 - 1/8 finale</div>
</div>

<div class="timeit" data-start="2018-7-1 22:50" data-end="2018-7-2 01:00">
<div class="time">Eurosport2 - 19:00</div>
<div class="teams">Toronto FC - New York Red Bulls</div>
<div class="league">Major League Soccer</div>
</div>



<script type="text/javascript" src="jQuery.js"></script>
<script type="text/javascript" src="timeit.js"></script>
</body>
</html>

最佳答案

使用display:none隐藏元素,同时移除元素空格

.hidden {   
display: none !important;
}

如果您仍然需要元素空间,则使用 visibility:hidden

.hidden {   
visibility:hidden;
}

关于php - 我的时间隐藏不能正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51123912/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com