鼠标悬浮行变色离开时恢复,按照文档写的js,为什么特别卡呢,像是有延时似的

https://help.fanruan.com/finereport/doc-view-1201.html

FineReport 杜杜dudu 发布于 2022-12-7 17:33
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共3回答
最佳回答
0
zsh331Lv8专家互助
发布于2023-8-7 00:11

-- 鼠标点击/悬浮时修改单元格背景接口-https://help.fanruan.com/finereport/doc-view-4301.html

-----------

最佳回答
0
15922204585Lv6高级互助
发布于2022-12-7 17:43

试试10.0的

JS实现鼠标点击行变色-https://help.fanruan.com/finereport10.0/doc-view-1201.html

最佳回答
0
uBestMaxLv6见习互助
发布于2022-12-7 18:02

var $lasttd;//上一个单元格变量  

var lastcolor;//上一次颜色变量  

$('.x-table td').mousemove(function(){  

var tdid = $(this).attr("id");

var num=tdid.search("-");         //获取id中“-”符号第一次出现的索引  

    var id1=tdid.substr(0,num).replace(/[^0-9]+/ig,"");  //截取id值中的行号 

if(id1 != '1'){

if($lasttd){ $lasttd.parent('tr').find("td").css('background',lastcolor);}   //离开后原单元格恢复原色  

lastcolor=$(this).css('background-color');  

if(!lastcolor)  

lastcolor=$(this).css('background');//保存原始颜色  

$(this).parent('tr').find("td").css('background','yellow');//设置当前单元格为红色  

$lasttd=$(this);//保存上一个单元格

}); 

  • 4关注人数
  • 329浏览人数
  • 最后回答于:2023-8-7 00:11
    请选择关闭问题的原因
    确定 取消
    返回顶部