tl;dr
Sometimes we need to execute JavaScript when an element is resized.
Current solutions are based on the viewport dimension, not on...
For further actions, you may consider blocking this person and/or reporting abuse
Great article, thanks for creating the package and for write up. 👍
I seem to have use
toFixed()or something similarentry.contentRect.width.toFixed()to get the same result as you, otherwise the width is,967.40625.Mutation Observer also another option to observe the Element changes in DOM and it's supported all browsers.
MutationObserver MDN
Man, this is dope for responsiveness in angular! Thanks a lot! 🔥
I'm curious how I'd be able to test the Angular implementation using Jasmine? I'm not very knowledgeable about unit testing or the Jasmine framework, but have been asked to write unit tests for this functionality. Specifically these:
Would it be possible to provide a sample spec file in your StackBlitz example? Any help would be greatly appreciated.
Hi,
thx for sharing.
Am i right, that your code is producing a new instance of ResizeObserver for every element?
I discovered this article groups.google.com/a/chromium.org/g... and in there it is said that there will be a huge performance improvement if you create the ResizeObserver as a Singleton...
Regards
Stefan
Great explanation! Thanks for sharing.
Quick question, does it only work with
display: block;? If I try to remove this property then is not working anymore.I just updated to Catalina 10.15.0 and Safari 13.1 now support ResizeObserver
I have created this account just to say Thank you!
Thanks for mentioning ngZone and change detection, saved me some grief!