30.01.2021, 11:07
(29.01.2021, 08:03)admin Wrote: Full example, additional class is color-by-value. It changes text color depending on current value but any other CSS property can be changed this way.
Code:$(function() {
$('.color-by-value').each(function(_, el) {
var addr = $(el).data('object');
if (addr) {
grp.listen(addr, function(obj) {
var value = obj.value
, color = 'blue'; // default color
if (value >= 0 && value <= 6) {
color = 'red';
}
else if (value > 6) {
color = 'green';
}
$(el).css('color', color);
});
}
});
});
thank you admin.
great job
Best Regards,