Logic Machine Forum
Change font text from Visu - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9)
+--- Thread: Change font text from Visu (/showthread.php?tid=2452)



Change font text from Visu - JoseJimenez94 - 04.02.2020

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


RE: Change font text from Visu - admin - 04.02.2020

You can add/remove classes like this:
Code:
$('.cls1').addClass('cls2');
$('.cls3').removeClass('cls4');



RE: Change font text from Visu - JoseJimenez94 - 04.02.2020

(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


RE: Change font text from Visu - admin - 05.02.2020

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.