This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Make the text blink when the value is 1
#13
(07.08.2023, 12:13)Krists Wrote: Hello.What I have to change for text blinking ,if I want:
object value 0 = blink
object value 1 = no blink

The code below works opposite!!


Code:
$(function() {
  $('.color-by-value').each(function(_, el) {
    var addr = $(el).data('object');
    if (addr) {
      grp.listen(addr, function(obj) {
        var color;
        if (obj.value) {
          color = 'red';
        }
        else  {
          color = 'Green';
        }
        $(el).css('color', color).toggleClass('blink', obj.value);
      });
    }
  });
});
Code:
$(function() {
  $('.color-by-value').each(function(_, el) {
    var addr = $(el).data('object');
    if (addr) {
      grp.listen(addr, function(obj) {
        var color;
        if (obj.value) {
          color = 'red';
        }
        else  {
          color = 'Green';
        }
        $(el).css('color', color).toggleClass('blink', !obj.value);
      });
    }
  });
});
Reply


Messages In This Thread
RE: Make the text blink when the value is 1 - by RomansP - 07.08.2023, 12:58

Forum Jump: