Let’s say that you have an internal link in one of your post content:

That points to the div with id=”my-internal-element”:

The thing is that internal links (beginning with “#”, also called “fragments) are considered internal routes by BackboneJs app engine, so this will result in triggering an app route that does not exist (which leads to going back to app home screen) instead of going to the “Internal element”.

To solve that, here’s what can be done:

First, add the “q-theme-prevent-navigation” class to the link to prevent the app engine from handling it as a navigation link:

Then add the following code to your [app-theme]/js/functions.js file (or in a custom js module of your own included in your theme):

This makes the app screen scrolling to your target internal element when clicking on an internal link.

Published by Mathieu on March 7, 2020

Freelance Senior Web Developer, WordPress since 2009, JS/Backbone since 2012, Custom Back-End devs, WebApps and Plugins for clients and the community.

Leave a Reply

Your email address will not be published. Required fields are marked *

Having questions?

FAQ | Tutorials | Documentation

Or

Contact Us