lcdsantos/menuspy

Option to turn off anchors?

hackuun opened this issue · 4 comments

Hello. Am I able to turn off hash anchors changes entirely? I experience weird behavior with it. I am using menuspy together with moveto.

For example, hashTimeout: 0 does not work at all.

Added enableLocationHash in v1.2.0.

edphn commented

@iamdubx
Could you show me how did you implement menuspy along with moveto? I'm facing a lot of problems with that. Thanks in advance ;)

@edphn sure, here is it

<script>
import MoveTo from 'moveto'
import MenuSpy from 'menuspy'
export default {
  mounted () {
    const moveTo = new MoveTo()
    const triggers = document.getElementsByClassName('js-trigger')
    for (var i = 0; i < triggers.length; i++) {
      moveTo.registerTrigger(triggers[i])
    }
    const elm = document.querySelector('#main-header')
    new MenuSpy(elm, { // eslint-disable-line no-new
      threshold: 0,
      hashTimeout: 100
    })
  }
}
</script>
edphn commented

Thanks man 👍