Start a new discussion

To start a new discussion please visit the discussions section of the GitHub home page of the project.

Discussions on GitHub

You can also search our old self-hosted forums for any useful information below but please note that posting new content here is not possible any more.

The current item issue re. href with # and empty href

Home Forums Older releases 0.9.x The current item issue re. href with # and empty href

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #2361


    I’d like to say that SmartMenu is a great plugin!

    I just implemented it and it works well. However I have found one issue. When I turned on the markCurrentItem (CurrentTree is Off), I realized that all menu items left with href=”#” are set to ‘current’, just after one is selected and then the page is reloaded, as the address of the page is now my-page.html#.
    Similarly, if there is any local link on the page (e.g. ‘to-top’ linking to an <id> like #container) and is selected, the URL has now appended the id to the page name (my-page.html#container) and all menu items with href=”#” are ‘current’.
    More interesting is that when I changed several items in the menu to empty href (href=””), immediately after reloading the page all those items were set to the ‘current’ state.

    Should the script work this way?

    Rgds, Mario


    Yep, the hash in the link URL is neglected when detecting the current links. As for href="" – this links to the current location so it’s correctly detected as current. If you would like keep some of your links with dummy href attribute, to avoid the issue, you could use something like href="javascript:;" instead of href="#".


    Thanks! Solved.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘0.9.x’ is closed to new topics and replies.