lcdsantos / menuspy

A JavaScript library to make navigation menus highlight the item based on currently in view section.
https://leocs.me/menuspy/
MIT License
303 stars 38 forks source link

Option to turn off anchors? #8

Closed hackuun closed 7 years ago

hackuun commented 7 years ago

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.

lcdsantos commented 7 years ago

Added enableLocationHash in v1.2.0.

edphn commented 6 years ago

@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 ;)

hackuun commented 6 years ago

@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 6 years ago

Thanks man 👍