This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Aaron James
Posted Nov 12 - Read on Facebook

I'm using Benjamin's slider module to scrub through a price range. How do I keep the comma in the thousandths position? As soon as I slide, the comma is removed.


Alan Travis

RegEx is fun...
It's a black art that even Software Engineers will shy away from...

This is more than 1 line of code, but much easier to understand and explain to someone (read fellow designers). The gist of it is divide by 1000 to get the number part that's GREATER THAN 1000 and then use '%' which is the modulus operator to get the remainder... So the number part that's LESS THAN 1000. One quirk is that you have to zeroPad on the left of the hundreds part, but that's a very simple string manipulation.
" zeroPadHundreds = ('0000'+hundreds).slice(-3);"

In my experience, regex is also a pretty heavy and slow function, so if you were building something big doing a lot of regex string manipulation can have a big negative impact on performance.

Bilen Mujdaba

Working on some similar stuff as well. Still WIP but I have also managed to add $250 increments:

Johannes Georg

Interesting that you use Framer for prototyping (?) at Facebook.

Read the entire post on Facebook