Why Onepager Menus Fail

Often onepager menus fail. They work all right on the frontpage. But other pages will not load the page correctly.

Let’s say that we want a link, that should point to this ID deep below on your onepager:

<div id="myId"></div>

On a typical WordPress onepager you may be tempted to link like this:

<a href="#myId"> Somewhere deep below </a>

Or from the menu:

This code will work from your WordPress menu as long as you’re on the same page or post as these IDs. But when you navigate to other pages these links will not work at all. Because the ID myId is not found on the new page.

The cure is simple. Don’t link to internal IDs as above. Use the full path to your website in the WordPress menu, do like this:

Do this with all the IDs on your page. Then the links in your menu will work from pages and posts.


Comments

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Enable Notifications OK No thanks

We use cookies - more information

Multimusen.dk will set a few cookies from Doubleclick, Google and the Social Media plugins they ay set some cookies. Some of my pages use APIs - such as YouTube, LinkedIn, Google Fonts, Google Maps, Mapbox, Spotify, Jetpack, Twitter, Facebook &c.. Such plugins may set the odd cookie.

Close