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
#9
There's an easier way to show a widget by simulating a click on the element that opens it. Make sure that your sending script is not attached to the same element otherwise you will get a loop.

Here, when 1/1/1 value is true view is switched to plan 12 and if #widget-2 is not yet shown a click event is triggered on an element with class show-widget
Code:
$(function() {
  if (typeof grp == 'object') {
    grp.listen('1/1/1', function(obj, state) {
      if (state == 'value' && obj.value) {
        showPlan(12);

        if (!$('#widget-2').is(':visible')) {
          $('.show-widget').click();
        }
      }
    });
  }
});
Reply


Messages In This Thread
RE: Set a value when a widget come up - by admin - 23.03.2020, 15:29

Forum Jump: