使用jQuery

时间:2018-09-22 20:51:13

标签: jquery html-table colors break

我不会英语。抱歉。我正在写Google翻译。

我有一张关于班级和休息时间的表。

我想根据当前时间在表格中显示红线。

示例:

现在是09:00

中断时间(中断时间:09:10-09:30)如何使线条的背景颜色变为红色

我有一张关于课程和休息时间的表格

在此表中,所有课程和课间休息时间都写在相反的地方

我想更改此表的背景色线当前时间

我对jQuery时间了解不多

https://jsfiddle.net/yhc2rtL8

body {
	font-family: Arial,sans-serif;
	font-size: 1rem;
	font-weight: 400;
	line-height: 1.5;
	color: #212529;
	text-align: left;
}
.table {
	width: 100%;
	max-width: 100%;
	margin-bottom: 1rem;
	background-color: transparent;
}
.table td, .table th {
	padding: .75rem;
	vertical-align: top;
	border-top: 1px solid #dee2e6;
}
th {
	text-align: inherit;
}
.table-bordered, .table-bordered td, .table-bordered th {
	border: 1px solid #dee2e6;
}
.table-bordered thead td, .table-bordered thead th {
	border-bottom-width: 2px;
}
.table thead th {
	vertical-align: bottom;
	border-bottom: 2px solid #dee2e6;
}
.table-now, .table-danger > td, .table-danger > th {
	background-color: #f5c6cb;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table class="table table-bordered">
<thead>
<tr>
<th>#</th>
<th>Lesson</th>
<th>Lessons and Break Times</th>
</tr>
</thead>
<tbody>

<tr>
<th rowspan="2">1</th>
<td>First Lesson</td>
<td>08:30 - 09:10</td>
</tr>
<tr>
<td class="table-now">Break Time</td>
<td class="table-now">09:10 - 09:30</td>
</tr>

<tr>
<th rowspan="2">2</th>
<td>Second Lesson</td>
<td>09:30 - 10:10</td>
</tr>
<tr>
<td>Break Time</td>
<td>10:10 - 10:20</td>
</tr>

<tr>
<th rowspan="2">3</th>
<td>Third Lesson</td>
<td>10:20 - 11:00</td>
</tr>
<tr>
<td>Break Time</td>
<td>11:00 - 11:10</td>
</tr>

<tr>
<th rowspan="2">4</th>
<td>Fourth Lesson</td>
<td>11:10 - 11:50</td>
</tr>
<tr>
<td>Break Time</td>
<td>11:50 - 12:00</td>
</tr>

<tr>
<th rowspan="2">5</th>
<td>Fifth Lesson</td>
<td>12:00 - 12:40</td>
</tr>
<tr>
<td>Lunch Break</td>
<td>12:40 - 13:40</td>
</tr>

<tr>
<th rowspan="2">6</th>
<td>Sixth Lesson</td>
<td>13:40 - 14:20</td>
</tr>
<tr>
<td>Break Time</td>
<td>14:20 - 14:30</td>
</tr>

<tr>
<th rowspan="2">7</th>
<td>Seventh Lesson</td>
<td>14:30 - 15:10</td>
</tr>
<tr>
<td>Break Time</td>
<td>15:10 - 15:20</td>
</tr>

<tr>
<th>8</th>
<td>Eighth Lesson</td>
<td>15:20 - 16:00</td>
</tr>

0 个答案:

没有答案