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.

Backround image change
#2
Here's a working example that should be added to Custom JavaScript. Change tag, plan_id and img variables as needed.
Code:
$(function() {
  if (typeof grp != 'object') {
    return;
  }

  var tag = 'light';
  var plan_id = 1;

  function check() {
    var objs = grp.tag(tag);
    var res = false;
    
    $.each(objs, function(id, obj) {
      res = res || obj.value;
    });

    if (currentPlanId == plan_id) {
      var img;

      if (res) {
        img = '/scada/resources/img/light.png';
      }
      else {
        img = '/scada/resources/img/dark.png';
      }

      img = 'url(' + img + ')';

      $E.planBg
        .css('background-image', img)
        .data('background-image', img);
    }
  }

  grp.taglisten(tag, check);
  $E.body.on('showplan', check);
});
Reply


Messages In This Thread
Backround image change - by 2MAX - 07.08.2024, 11:43
RE: Backround image change - by admin - 28.08.2024, 12:53

Forum Jump: