javascript - Update nav bar links to active and smooth scrolling -
i trying implement nav bar list of <a>
tag navigate different part of current page , tag should change class active when user scrolling through page.
not sure best way implement on vue app not want use bootstrap jquery on it.
i found framework agnostic library: https://github.com/cferdinandi/gumshoe , smooth scrolling works, anchor tags not being set active. tried couple of other libraries implement updating of active no avail.
so not sure if setting external libraries correctly in vue.
what did include in index.html
<body> <div id="app"></div> <!-- built files auto injected --> <script src="static/js/gumshoe.js"> </script> <script src="static/js/smooth-scroll.min.js"> </script> <script> smoothscroll.init({ offset: 20 }); gumshoe.init(); </script> </body>
usage
<ul class="nav-right-items" data-gumshoe> <li class=""> <a data-scroll href="#about" class="">about me </a> </li> <li class=""> <a data-scroll href="#experience" class="">experience </a> </li> </ul>
Comments
Post a Comment