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.

Set a value when a widget come up
#2
You can use this example. Set Additional classes to widget-open for the element that opens the widget. #widget-2 is widget element id, change it and group address as needed.
Keep in mind that it won't work when transition animation is enabled.
Code:
$(function() {
  $('.widget-open').on('vclick', function() {
    var el = $('#widget-2');
    if (el.is(':visible')) {
      grp.write('1/1/1', 123);
    }
  });
});

There will be widget show/hide events added in RC2 firmware that will work correctly with animation:
Code:
$(function() {
  $('#widget-2').on('widget-show', function() {
    grp.write('1/1/1', true);
  });
  
  $('#widget-2').on('widget-hide', function() {
    grp.write('1/1/1', false);
  });
});
Reply


Messages In This Thread
RE: Set a value when a widget come up - by admin - 22.03.2020, 14:34

Forum Jump: