New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Listen for document resize? #32
Comments
Hello, thank you for feedback. I assume ResizeObserver callback is firing after actual height of the document is changes, so you do not need schedule setting sizes and draw immerser. And you can call setSizes and draw methods in your callback. I think I will add your approach in the documentation, but first I need to design and add a section for recipes ;) |
I dont understant 100% what you said, but yes, the problem is with actual document height changes. My question can be simplified: why not add to this |
We already have this here https://github.com/dubaua/immerser/blob/master/src/immerser.js#L237 Your problem is you change document height manually, and resize event isn't fired this case. Because resize event fired when you resize browser window. Instead of listen to window resize, you should manually call setSizes and draw methods on immerser instance after height is changed. You can do it after DOM manipulation. |
Yes, thats what Im talking about. Shouldnt that be implemented from default? |
How can library know when DOM is manually changed? |
Good question :D I got carried away with my specific case. I think it would be best to add this solution into recipes section as you said :) |
@Cevorob Hi! I've just updated documentation, added recipe to handle DOM change and related immerser |
Hi, Im very happy with how immerser works, but I use it on a website with a lot of animations etc. and I cant make it without some javascript that affects document height (dropdowns, sliders,...). I saw a handleResize() function used on window resize, so I added ResizeObserver for the whole document and used the handleResize function in each entry. This solution works as I wanted, wouldnt it be a good idea to implement this in Immerser? Or mention it somewhere as a possible solution?
The text was updated successfully, but these errors were encountered: