Routing to an anchor on a different route

Hi! I’m relatively new to ember, and am struggling to figure out a way to create a link-to that will route to ‘index’ then scroll to a particular anchor.

When users click on the feature’s on any page, I’d them to be routed to ‘index’ then have the page scroll to the “features” anchor.

I’m currently using ember-scroll-to-mk2. Upon clicking the link on the ‘index’ page, it works perfectly. But clicking the link on any route other than ‘index’ the link doesn’t work.

Any suggestions would be greatly appreciated.

<nav class="navbar navbar-light bg-faded bg-dark">
    <ul class="nav navbar-nav navbar-right">
      <li class="nav-item">
        {{#link-to 'index' class="nav-link"}}Home{{/link-to}}
      </li>
      <li class="nav-item">
          {{#scroll-to target = "#features"}}Features{{/scroll-to}}
      </li>
      <li class="nav-item">
        {{#link-to 'about.technology' class="nav-link"}}Technology{{/link-to}}
      </li>
      <li class="nav-item">
        {{#link-to 'about.our-story' class="nav-link"}}About{{/link-to}}
      </li>
    </ul>
  </nav>
1 Like

Not answering your question but perhaps interesting. We just use ember routes for something similar. See going to route 4: TVGsite

Thanks for the response @broerse! The scroll to anchor functionality works great! How have you achieved this? :smiley: