DEV Community

Discussion on: 🤯 More to Media Queries than meets the eye 👁️ (in JavaScript example with Vue.js)

Collapse
 
johncarroll profile image
John Carroll • Edited

👍. Similarly, for situations where you wish to style an element based on it's display size (or the display size of the element's container)--rather than the browser's screen size--I made an Angular library to help out: dev.to/johncarroll/angular-size-ob.... Useful when a container's size is dynamic but not dependent on the window's size.

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀 • Edited

Hey John, nice work! Looks like ResizeObserver? As an asside, I mentioned a decorator in the post above, I feel like I should show you as you are in with the Angular camp.

Note that the code in this decorator could be improved by the code in this post because adding listeners to window is not the correct way, but you get the idea, it looks cool.

Collapse
 
johncarroll profile image
John Carroll

This is cool. Took me a second to realize I had to open up the console to see the output.

Looks like ResizeObserver

Ya, its a relatively simple angular wrapper around ResizeObserver.