Topic: mdbParallax not working with NUXT.js
renatoxm pro asked 4 years ago
Expected behavior Parallax working Actual behavior Error: window or document undefined Resources (screenshots, code snippets etc.) I tried to put the component inside the error stopped but parallax is not rendered.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Status
Opened
Specification of the issue
- ForumUser: Pro
- Premium support: No
- Technology: MDB Vue
- MDB Version: 6.3.0
- Device: pc
- Browser: firefox
- OS: windows
- Provided sample code: No
- Provided link: No
Mikołaj Smoleński staff commented 4 years ago
Thanks for reporting the issue. It won't work, since Nuxt is not compatibile with
window
object. We will do our best to find a workaround.Best regards
Tenarius free commented 4 years ago
Parallax works for me with nuxt 2.0.0 and mdbvue 6.7.1. You may need to install some JS files manually. In this case, follow the instructions at: https://nuxtjs.org/guide/plugins/
Mikołaj Smoleński staff commented 4 years ago
Thanks for your remarks. Best regards
GuillaumeDgr premium commented 3 years ago
Hi Tenarius, could you pls be more specific ? Which JS files do we need to install manually (as nuxt plugin ?) ? Do you have some example ? Many thanks for your help
GuillaumeDgr premium commented 3 years ago
Any feedback pls ? thks
Mikołaj Smoleński staff commented 3 years ago
Hi there again,
Unfortunately Parallax will not work properly in Nuxt with SSR as its state depends on the browser window object, which is undefined on the server-side.
To fix the issue, please disable ssr: https://nuxtjs.org/docs/2.x/configuration-glossary/configuration-ssr
Keep coding, Mikołaj from MDB