Scrollspy just does not work - does it need enabling?

I just can’t get scrollspy to work.

HTML output:

<div class="navbar-collapse collapse" id="navbarResponsive" style="">
 <ul id="menu-main-menu" class="nav justify-content-end">
  <li id="menu-item-6" class="page-scroll menu-item menu-item-type-custom menu-item-object-custom menu-item-6"><a title="Who we are" href="#who-we-are">Who we are</a></li>
  <li id="menu-item-7" class="page-scroll menu-item menu-item-type-custom menu-item-object-custom menu-item-7"><a title="What we do" href="#what-we-do">What we do</a></li>
  <li id="menu-item-8" class="page-scroll menu-item menu-item-type-custom menu-item-object-custom menu-item-8"><a title="Our Work" href="#our-work">Our Work</a></li>
</ul>
</div>

And have tried adding to the body tag:

data-spy="scroll" data-target="#navbarResponsive" data-offset="0"

and via javascript:

$('body').scrollspy({ target: '#navbarResponsive' });

but nothing works - am I missing something here? Does it need enabling in Sage v9+/BS4? No errors in the console but it’s driving me crazy.

1 Like

Hi! I have completely the same problem. Have you figured it out?

First the obvious things: Is scrollspy enqueued as script or built into the main theme JS file (webpack)?
Any errors in JavaScript console (F12, Console tab)?

Btw.: I personally love to use gumshoe for scroll tracking: