Issue
I have a menu made from WordPress that serves as my site’s navigation. Every main item in this menu is a Page Type (redirects to other existing pages) with one of them having submenus that are custom links.
These custom links’ URLs are div IDs from the its parent page. This is how it’s structured.
About Us
- Who we are
- What we do
- How we do
So the submenus URLs are #who-we-are
, #what-we-do
, and #how-we-do
which are sections from the About Us page. Now my problem is that when I am in the About Us page, the submenus links works properly. It scrolls up/down to the section it should. But when I am in another page (let’s say Homepage), it doesn’t redirect to it as it can’t find any section in the page with that div.
Any ideas on what I should put on the URLs instead? Thanks in advance.
Solution
To get it to work, you have to attach the id tags to the url (otherwise it is treated as a relative link).
Example:
- A main page: http://yourdomain.com/page1
- Section URL: http://yourdomain.com/page1#who-we-are
Answered By – xphan
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0