Menu icon Foundation
Is it safe to rerun document.foundation()?

I am building a single page webapp (using GWT); as the user browses through the app, sections of HTML may be swapped out with new widgets (e.g. I add a topbar after the user logs in). Because document.foundation() was run only on initial load, components that are add later don't work unless I rerun document.foundation() after adding them to the DOM. Is it safe to do this, or should I do something more targeted?

Thanks

initializationjsjavascriptinit

I am building a single page webapp (using GWT); as the user browses through the app, sections of HTML may be swapped out with new widgets (e.g. I add a topbar after the user logs in). Because document.foundation() was run only on initial load, components that are add later don't work unless I rerun document.foundation() after adding them to the DOM. Is it safe to do this, or should I do something more targeted?

Thanks

Rafi Benkual almost 6 years ago

You can run $(document).foundation(); again. Foundation will look for the JS components that have not been initialized and initialize them.