Making menu subitems link to relative anchors (1 post)

  1. publicradio
    Posted 3 years ago #

    Here's what I'm trying to do:

    I would like a menu with links, and submenus with anchors.

    The main links have absolute urls, like http://site.com/page1 and http://site.com/page2.

    I want the submenu items to have relative links, like #anchor instead of http://site.com/page1#anchor, or /page1#anchor. The reason for this is that I'm using a jquery script that glides to your anchor, and when the url is in the link, the browser reloads the page as though you're going to a new url.

    However, this isn't going to work when you go from page to page. from /page1, if you want to get to page2/#anchor, and the sublink is just #anchor, it's going to try to find that anchor on the current page.

    This means that if you're on a parent page, The children have relative urls, and if you're not on the parent, the children have absolute ones. How would I make this work?

Topic Closed

This topic has been closed to new replies.

About this Topic