fit.js
fit.js copied to clipboard
improvement: watch the container size
It would be nice to be able to actually watch the container, and trigger fitting when it changes, not just when the window size changes :)
Real life case: a video element being part of the WebRTC communication client with collapsible chat drawer. When the chat collapses, the video resizes and refits but no window resize event in happening. No debounce needed as the resize has to as smooth as poss.
Thanks!
Although, on the second thought maybe it's not a good idea to have it included with fit.js – since the use case scenario will always be different. I've ended up adding RAF when CSS3 transition starts and killing it when it ends.