I have a rather simple idea, but i have no idea how execute it properly.
Goal: Calculate a value from a CMS number-value (make a division by a fixed number) and use the result for the width of a DIV.
I have a collection that has a number. I need this number to be divided by 630.
Then i want use the result for the width (as a %) for a div.
I need this calculated for each CMS item in the collection.
PS. i use this to make ‘bars’ that fill up.
I know what the max values are, so i can divide the CMS number by a fixed number).
It could be done with CSS calc() but that isn’t supported (yet).
I have no idea how to do this with or if i need or can use jquery f.e.
Can anybody offer help?
Webflow supports anything CSS even if it’s not in the UI yet.
INside of a Collection List, OR inside of a template page (in order to have access to the CMS variable), us a Custom Code component inside of the page (NOT in the page settings) and craft you calc rule for the class of the element you’re targetting. Select your variable and click on top right of the custom code box to swap it by your CMS variable.
That works now - but i can only use px or mm, or em.
I first need to (re)calculate the Webflow CMS number into a new number.
CSS calc is on the wishlist, but isn’t shipped or anything if i’m correct?
Great, thanks a ton for coming back to report. This is exactly what I had described. Kudos for putting that together. Isn’t this great? CSS Calc is awesome.
No problem! This is really awesome and powerfull!
This should be reported in other CSS calc threads as well - i was only reading that this is not implemented and you should go to the wishlist and vote.