Counter (add character after counter like € or %) and change comma in dot

4 replies · opened Apr 2, 2020

DDiaNina2SaApr 2, 2020

Hello

  1. I'm looking for a way to add text, in this case 1 character behind the counter (like € or %). I tried adding "data-append =" € "" but it doesn't work.
  2. On the other hand, I would like in one of my counters to replace the "," thousands separators with "." (comma to dot).

Please tell me how to do it.

SSemicolon WebSTAFFApr 3, 2020

Hello,

  1. This is already possible with the current codes and there is no need to add any data attributes. You can simply add the Text after the <span> Tag. Example:

&euro;
  1. Unfortunately, this is not supported for Individual Counters at the moment. All the counters will be affected. If you wish to move forward with this, then please find the following code in the js/functions.js File inside the runCounter Function Block:

value = value.replace(/\B(?=(\d{3})+(?!\d))/g, ',');

and replace it with:


value = value.replace(/\B(?=(\d{3})+(?!\d))/g, '.');

and then set the data-comma="true" Attribute on the .counter Element.

This will definitely work fine. Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

DDiaNina2SaApr 3, 2020

Thank you for your reply, it works perfectly.
However, I just noticed that if I enter a decimal number, it also displays with a dot. Could you tell me how to change the point of decimal numbers in comma? Thank you in advance.

SSemicolon WebSTAFFApr 3, 2020

Hello,

As mentioned in our previous reply, this is currently not supported for Individual counters. By changing the above code, all the Counters will display a Dot. Decimal or not. We will release an update soon to allow different separators.

Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

DDiaNina2SaApr 3, 2020

Hello,

Thank you very much for your reply.

Best regards

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard