Skip to content
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

Dropdown stops working after navigation in SPA #291

Closed
stescacom opened this issue Feb 26, 2024 · 1 comment
Closed

Dropdown stops working after navigation in SPA #291

stescacom opened this issue Feb 26, 2024 · 1 comment

Comments

@stescacom
Copy link

I have noticed using livewire 3 with preline. the dropdown stop working after navigation.

Lets assume we have 2 top level navigation

  1. Dashboard <a href="..." wire:navigate>Dashboard</a>
  2. Dropdown Menu (preline code)
    2.1 Nav 1 <a href="..." wire:navigate>Nav 1</a>
    ...

When the page changes the dropdown will not show. It will only show if you refresh the whole page.

@MuriloAkita
Copy link

Try adding this in app.js:

document.addEventListener("livewire:navigating", () => {
    HSStaticMethods.autoInit();
});

document.addEventListener("livewire:navigated", () => {
    HSStaticMethods.autoInit();
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants