如何突出显示表格的第一行2秒钟并返回到原始状态

问题描述

|| 我有一张桌子,一旦我添加一行,它的背景颜色就会改变以显示更改(突出显示会很好)。这是我在做什么
$(\"#tableDg tbody tr:first\").css(\"background-color\",\"red\")
所以为了延误工作,我做了
$(\"#tableDg tbody tr:first\").css(\"background-color\",\"red\").delay(2000).css(\"background-color\",\"aqua\");
但是除了延迟它之外,它还只是将bkg颜色绘制为aqua,我对此有何评论?谢谢     

解决方法

        
$(\"#tableDg tbody tr:first\").css(\"background-color\",\"red\");

setTimeout(function() {
    $(\"#tableDg tbody tr:first\").css(\"background-color\",\"aqua\");
},2000);
要添加高光效果:
$(\"#tableDg tbody tr:first\").css(\"background-color\",\"aqua\").effect(\"highlight\",{},3000);
},2000);
或这个:
$(\"#tableDg tbody tr:first\").css(\"background-color\",\"aqua\");
    $(\'#tableDg tbody tr:first\').effect(\"highlight\",2000);
    ,        也许这会有所帮助: 我向该行添加了一个data属性以突出显示我想要的那个,因此我将其命名为data-id。 获取原始背景色 动画以突出显示颜色 等待500毫秒 设置为原始颜色(淡出) 删除样式,以便样式表可以正常工作。
var highlight_color = \"#fbec88\";
var original_color = $(\'#myTable tbody tr[data-id=\"\' + id + \'\"]\').css(\"background-color\");

$(\'#myTable tbody tr[data-id=\"\' + id + \'\"]\')
.animate({
\'background-color\': highlight_color
},\'slow\',\'swing\')
.delay(500)
.animate({
\'background-color\': original_color
},\'swing\',function () { 
                    $(\'#myTable tbody tr[data-id=\"\' + id + \'\"]\').removeAttr(\"style\"); 
                });
    ,        如果需要一个延迟,则应使用use6ѭ     

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...