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.

Change image from Url
#1
Hi,

Is there anyway to change an image in JS depending of an object?

I have an object that update url that give me an image and I want to show it in visualization.

Thanks
Reply
#2
Hi,

Yes you can do that (off course) (:

Add a image to your visu with a default remote URL and give it a additional class 'dynamic', add a 250 byte object that holds the dynamic URL, in this sample '1/1/1' and add this to your custom JS:
Code:
$(function(){
  if (typeof grp === 'object') {
    grp.listen('1/1/1', function(obj, state) {
      $('.dynamic').find('img').attr("src", obj.value)
    },true);
  }
});
BR,

Erwin
Reply


Forum Jump: