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.

flashing alert
#10
If you reference $('.alert') further in the code this means that all elements with alert class will be flashed if at least one objects is set to true. So it won't work for multiple/different alert objects. Try this (not tested):
Code:
$(function() {
  $('.alert').each(function(_, el) {
    var $el = $(el);
    var addr = $el.data('object');
    var timer;

    if (addr) {
      grp.listen(addr, function(obj) {
        if (obj.value) {
          if (!timer) {
            timer = setInterval(function() {
              $el.toggleClass('hide');
            }, 500);
          }
        }
        else {
          $el.removeClass('hide');
          clearInterval(timer);
          timer = null;
        }
      });
    }
  });
});
Reply


Messages In This Thread
flashing alert - by Nir70 - 28.09.2021, 05:37
RE: flashing alert - by admin - 28.09.2021, 05:45
RE: flashing alert - by Nir70 - 28.09.2021, 15:55
RE: flashing alert - by Dré - 28.09.2021, 17:13
RE: flashing alert - by Nir70 - 06.10.2021, 05:40
RE: flashing alert - by Nir70 - 06.10.2021, 11:16
RE: flashing alert - by admin - 29.09.2021, 06:12
RE: flashing alert - by khalil - 29.09.2021, 07:34
RE: flashing alert - by Nir70 - 29.09.2021, 19:53
RE: flashing alert - by khalil - 30.09.2021, 07:00
RE: flashing alert - by Nir70 - 30.09.2021, 08:52
RE: flashing alert - by khalil - 30.09.2021, 09:00
RE: flashing alert - by Nir70 - 30.09.2021, 10:42
RE: flashing alert - by admin - 29.09.2021, 08:16
RE: flashing alert - by khalil - 29.09.2021, 10:22
RE: flashing alert - by Nir70 - 29.09.2021, 10:33
RE: flashing alert - by admin - 29.09.2021, 10:36
RE: flashing alert - by khalil - 29.09.2021, 11:11
RE: flashing alert - by Daniel - 30.09.2021, 10:55
RE: flashing alert - by Daniel - 06.10.2021, 07:33

Forum Jump: