scrollSpy

There are multiple components used by scrollspy

  • Scrollspy service is used to keep track of all and active anchors
  • Multiple directives including:
  • mac-scroll-spy - Element to spy scroll event
  • mac-scroll-spy-anchor - Section in element spying on
  • mac-scroll-spy-target - Element to highlight, most likely a nav item
Parameters:
Name Type Description
register function

Register an anchor with the service

  • {String} id ID of the anchor
  • {Element} element Element to spy on
unregister function

Remove anchor from service

  • {String} id ID of the anchor
setActive function

Set active anchor and fire all listeners

  • {Object} anchor Anchor object
addListener function

Add listener when active is set

  • {Function} fn Callback function
removeListener function

Remove listener

  • {Function} fn Callback function