Im trying to link to a specific section of my home page while maintaining a scroll spy feature.
With this code:
<li><a href="#sec1">About</a></li>
the scrollspy is functioning but if I try to access it from a page other than my home page it just adds "#sec1"
to the current page's url, to no effect.
If I change it to:
<li><a href="/#sec1">About</a></li>
It takes me to the correct section on the home page, but the scrollspy function no longer works.
js code
$(function(){/* smooth scrolling for scroll to top */
/* highlight the top nav as scrolling occurs */
$('body').scrollspy({ target: '#navbar' })
});
Any ideas?