Changing css variable values through javascript

233 views
Skip to first unread message

Viktor Kojouharov

unread,
Jun 2, 2015, 4:06:22 AM6/2/15
to polym...@googlegroups.com
Hi,

Under the new styling system, is it possible to change the value of a css variable to something else (possibly even another css variable), so that all elements whose styles use that variable are automatically updated?

Justin Fagnani

unread,
Jun 8, 2015, 8:34:28 PM6/8/15
to Viktor Kojouharov, Steve Orvell, polymer-dev
+ Steve

On Tue, Jun 2, 2015 at 1:06 AM, Viktor Kojouharov <vkojo...@gmail.com> wrote:
Hi,

Under the new styling system, is it possible to change the value of a css variable to something else (possibly even another css variable), so that all elements whose styles use that variable are automatically updated?

Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/dbc2e429-daba-4a9a-aae8-2dba2f158dbf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Steve Orvell

unread,
Jun 8, 2015, 9:13:34 PM6/8/15
to Justin Fagnani, Viktor Kojouharov, polymer-dev
There's some info here, but the documentation is not quite complete yet: 


To cause properties to re-evaluate, you can call `this.updateStyles()` or `Polymer.updateStyles()` to cause the entire document to re-evaluate.

You can modify the property values of an element directly via the `customStyle` property (to be documented). For example: `this.customStyle['--foo'] = 'red';`


Reply all
Reply to author
Forward
0 new messages