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

Floating buttton not works after landing different page and come back #6627

Closed
bitdom8 opened this issue Feb 21, 2021 · 2 comments
Closed

Floating buttton not works after landing different page and come back #6627

bitdom8 opened this issue Feb 21, 2021 · 2 comments

Comments

@bitdom8
Copy link

bitdom8 commented Feb 21, 2021

Expected Behavior

I want to go to different site page and coma back see it working again.

Current Behavior

I need to reload the page to mount to event lisstener again. It breeaks somewhere between.

Here is the code:

<div class="fixed-action-btn">
  <a class="btn-floating btn-large red">
    <i class="large material-icons" @click="lop">mode_edit</i>
  </a>
  <ul>
    <li><a class="btn-floating red"><i class="material-icons">insert_chart</i></a></li>
    <li><a class="btn-floating yellow darken-1"><i class="material-icons">format_quote</i></a></li>
    <li><a class="btn-floating green"><i class="material-icons">publish</i></a></li>
    <li><a class="btn-floating blue"><i class="material-icons">attach_file</i></a></li>
  </ul>
</div>
  mounted() {
    this.items = this.recipes
    document.addEventListener('DOMContentLoaded', function () {
      var elems = document.querySelectorAll('.fixed-action-btn')
      var instances = M.FloatingActionButton.init(elems)
    })
  },
@bitdom8
Copy link
Author

bitdom8 commented Feb 21, 2021

It NOT works when I use this Nuxtlink:


            <li class="tab col s3">
              <NuxtLink :to="localePath('/account/login')"
                ><i class="material-icons">history</i>Hesap</NuxtLink
              >
            </li>

It WORKS with this one though:

            <li class="tab col s3">
              <a href="/tr">Sass</a>
            </li>

@bitdom8
Copy link
Author

bitdom8 commented Feb 25, 2021

Have solved:

     ```

// document.addEventListener('DOMContentLoaded', function() {
var elems = document.querySelectorAll('.carousel');
var instances = M.Carousel.init(elems, {fullWidth: false, indicators: true});
// });

You need to remove document.addEventListener('DOMContentLoaded', function() {, otherwisee DOM elementts only bind to event listeners when page is fully reloaded again 

@bitdom8 bitdom8 closed this as completed Feb 25, 2021
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

1 participant