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 font text from Visu
#1
Hi guys,

I am trying to include more complex elements to my visualizations and after seeing a bit of the whole issue of adding additional classes along with the custom Css I have a question. 
Is it possible to change from the display (using a button, slider, etc.) the additional class of a text to be able to change the type of font, for example?

Thanks a lot Big Grin
Reply
#2
You can add/remove classes like this:
Code:
$('.cls1').addClass('cls2');
$('.cls3').removeClass('cls4');
Reply
#3
(04.02.2020, 13:46)admin Wrote: You can add/remove classes like this:
Code:
$('.cls1').addClass('cls2');
$('.cls3').removeClass('cls4');

Thanks admin,
but i'm not sure how to use those functions in javascript.
I mean, if I have a button (address 1/1/1) that when pressed, I change the additional class of a text (from .cls1 to .cls2 for example), should i put in javascript ?:

      grp.listen('1/1/1', function(obj) {
      $('.cls1').addClass('cls2');
      }

, and in the additinal class of the text what should i write: cls1, cls2 or what?

Sorry for the inconvenience Sad
Reply
#4
Your script is not fully valid as it will change the class on any object value change. You are missing some if statements to check the object value.

$('.cls1').addClass('cls2'); will add class named cls2 to all elements that have class cls1 assigned to them.
Reply


Forum Jump: