8 ms·
Agreed. I was forced to work with JS-in-CSS and i still dont get their reasoning behind it at all. All use cases in their examples were easily solveable with CS
by herbst 11y ago
Agreed. I was forced to work with JS-in-CSS and i still dont get their reasoning behind it at all. All use cases in their examples were easily solveable with CSS if you fixed up a bit of the bad CSS they shipped with.
It was just a very lazy approach to handle something they lost control for.
- err4nt 11y agoCan you give an example where somebody used JS inside CSS for a solution CSS alone could have provided? EDIT: I can't seem to reply down below, but in my plugin for example we've implemented a few responsive conditions: - min-scroll-x - max-scroll-x - min-scroll-y - max-scroll-y So if you needed to trigger a style (or a whole block of styles) when the page, or any element you specify has a scroll position meets the conditions above. By combining these conditions with other conditions, it makes it DEAD simple for CSS-only designers to be able to write responsive JavaScript! @element 'body' and (min-width:900px) and (min-scroll-y: 100vh) { header { position: fixed; } }
- herbst 11y agoI cant simply provide a solution for your edit thats true. But i assume this to create massive overhead just to enable CSS do something it never was supposed to? It maybe just does not fit into my world view, but thats simply wrong to my eyes CSS is not supposed to know that much about the view.
- herbst 11y agoSure. Most of the time they used it to trigger jQuery fadeIn/fadeOut or move boxes which would have moved if the CSS would have followed a basic grid system other than a <div> construct reassembling tables. Its a worstcase probably, but i also do not find any sitations where it would make more sense to traditional methods.