jquery根据table表格数值大小设置单元格背景色插件

所属分类: 网页特效-其它&杂项    2023-11-28 05:10:10

jquery根据table表格数值大小设置单元格背景色插件 ie兼容6
 查看演示  登录后下载 温馨提示
登录会员即可享受免费下载
 我要建站

jquery根据table表格数值大小设置单元格背景色插件(共3个文件)

    • index.html

使用方法

$(document).ready(function(){
        Array.max = function(array){
        return Math.max.apply(Math,array);
    };

    var counts= $('.heat-map tbody td').not('.stats-title').map(function() {
        return parseInt($(this).text());
    }).get();
	
    var max = Array.max(counts);
    console.log(counts);
	console.log(max);
    n = 90; 

    xr = 255; // Red value
    xg = 255; // Green value
    xb = 255; // Blue value
 
  //User Defined Color
    yr = 143; // Red value
    yg =72; // Green value
    yb = 117; // Blue value
 
  
    $('.heat-map tbody td').not('.stats-title').each(function(){
        var val = parseInt($(this).text());
		console.log(val);
        var pos = parseInt((Math.round((val/max)*80)).toFixed(0));
		console.log(pos);
        red = parseInt((xr + (( pos * (yr - xr)) / (n-15))).toFixed(0));
		console.log(red);
        green = parseInt((xg + (( pos * (yg - xg)) / (n-15))).toFixed(0));
		console.log(green);
        blue = parseInt((xb + (( pos * (yb - xb)) / (n-15))).toFixed(0));
		console.log(blue);
        clr = 'rgb('+red+','+green+','+blue+')';
		console.log(clr);
		$(this).css({backgroundColor:clr});
    });
});

站长提示:
1. 苦力吧素材官方QQ群:950875342
2. 平台上所有素材资源,需注册登录会员方能正常下载。
3. 会员用户积极反馈网站、素材资源BUG或错误问题,每次奖励2K币
4. PHP源码类素材,如需协助安装调试,或你有二次开发需求,可联系苦力吧客服。
5. 付费素材资源,需充值后方能下载,如有任何疑问可直接联系苦力吧客服
相关资源 / 其它&杂项

基于DataTables创建的响应式表格布局代码

一款响应式table表格代码,根据不同的分辨率友好的显示table表格,非常的实用。
  其它&杂项
 8655  0

jquery商品添加到购物车功能

一款将商品加入购物车特效,当用户决定购买某件物品的浮动购物车交互效果!可查看购物车商品列表以及价格统计。
  其它&杂项
 8535  0

jquery Cookie同意提示插件

一款在网页顶部弹出的提示信息,点击可关闭隐藏。
  其它&杂项
 7882  0

jquery支持最新的Unicode表情符号emoji标签选择器插件

一个轻量级表情符号选取器,支持最新的Unicode表情符号,并使用Twitter的Twemoji提供3200+SVG和PNG表情符号图标。
  其它&杂项
 7854  0

评论数(2) 回复有机会获得K币 用户协议

    great0
    2023-12-11 15:38:30
    xiaoshenzhen0
    2023-12-11 11:15:15
😀
  • 😀
  • 😊
  • 😂
  • 😍
  • 😑
  • 😷
  • 😵
  • 😛
  • 😣
  • 😱
  • 😋
  • 😎
  • 😵
  • 😕
  • 😶
  • 😚
  • 😜
  • 😭
发表评论