3 ms·
If you're looking for a way to use JavaScript variables directly in CSS styles there is an Element Query polyfill that includes that feature: http://codepen.io/
by err4nt 11y ago
If you're looking for a way to use JavaScript variables directly in CSS styles there is an Element Query polyfill that includes that feature: http://codepen.io/tomhodgins/pen/MKWOWW http://codepen.io/tomhodgins/pen/MKWOWW
You can reference one line of JS in your CSS style, and the returned value is what is output in your CSS at the time the (responsive) style applies. This value can be a Js variable set elsewhere on the page, the output of a function, or a string or single line of JavaScript that is evaluated in-place.
The var() feature is new and only in the v1.0.0 branch right now, but to read about the other features of this plugin check out https://github.com/eqcss/eqcss https://github.com/eqcss/eqcss and http://elementqueries.com http://elementqueries.com