【发布时间】:2019-05-24 03:59:11
【问题描述】:
新旧价格记录, 如果新价格与旧价格不同,则突出显示记录。
我想使用“setTimeout”功能,高亮效果会在10s后消失。如何根据值突出显示表格行?
我使用 jQuery-UI 框架。
$(function(){
setTimeout(change(), 3000);
});
function change(){
$(".table-striped").find("tr").each(function () {
$("td").filter(function() {
return $(this).text().indexOf("200") != -1;
}).parent().toggleClass("highlight",5000).removeClass("highlight");
});
}
<table class="table table-striped">
<thead>
<tr>
<th>New Price</th>
<th>Old Price</th>
</tr>
</thead>
<tbody>
<tr>
<td>200</td>
<td>1000</td>
</tr>
<tr>
<td>1000</td>
<td>1000</td>
</tr>
</tbody>
</table>
.highlight {
background: red !important;
color: green !important;
}
【问题讨论】:
-
@AkshayMulgavkar 不错,但我想要背景颜色闪烁和突出显示的效果:P
-
您使用哪种技术打印表格值?
-
我使用 jQuery UI 框架
-
我已经用 jquery 解决了你的问题,请检查我的答案。
标签: javascript jquery css jquery-ui