-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Update scene start after DOM removal? #307
Comments
Actually this should be handled automatically. |
Sorry, I JUST figured it out. You are right, it is handled automatically and correctly. I had two scenes attached to the particular DOM element that I was removing. One to trigger a reveal animation and another scene to trigger the removal of the element. When I removed the element, I was only removing one of those scenes (from the controller) before removing the actual DOM element. So this triggered a type error of "Cannot read property 'hasAttribute' of null" in the updateTriggerElementPosition function during the update. I guess because it was trying to update the un-removed scene and it's element was no longer inside the DOM. Might be a good idea to do a sanity check on the "while (telem.parentNode.hasAttribute(PIN_SPACER_ATTRIBUTE))" loop? |
I'll look into that. thx :) |
Investigating this I actually stumbled over a bug: When removing the triggerElement the trigger position wasn't reset to 0 (unless explicitly triggered). Thanks again for posting this. |
Both using Scene.triggerElement(undefined) or removing a triggerElement from the DOM caused problems, which are now resolved. See: #307
My apologies if this is covered somewhere already; my searching has failed me.
If I remove DOM elements, which happen to come before the start of an existing scene, is there any way to update the start of the scene now that it is in a different scroll position?
I've tried Controller.update() and Scene.update().
The only thing that seems to work for me is to remove all remaining scenes from the controller and then add them back in.
Thanks!
The text was updated successfully, but these errors were encountered: