Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3935010
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:46:52+00:00 2026-05-19T23:46:52+00:00

I currently working on the menu system for this site . I have the

  • 0

I currently working on the menu system for this site.

I have the following code, which is working fine:

$('#menu .container ul li:not(:first-child)').fadeOut()

$('#menu .container ul li:first-child').click(function() {
    $(this).siblings().fadeToggle();
})

I’m just hiding all the menu items to clean up the navigation a bit. What I now want to do is have the browser detect which section you’re currently viewing (ie if you’re looking at Magda under Latest Work) and automatically show that section. I’m not quite sure how to go about this. Maybe detect the URL, then find the URL in #menu .container, and .show() all of its siblings when it loads? Can anyone help on this one?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T23:46:53+00:00Added an answer on May 19, 2026 at 11:46 pm
    $("#menu a").each(function() {
      if($(this).attr('href') == window.location.href) {
        //Show the menu.
      }
    });
    

    You’ll have to fill in the bit that actually shows the menu, though. Let me know if you need help with that as well.

    I tested it briefly in the Chrome Javascript console and it seemed to find the correct element. Be sure to test it across multiple browsers, though. I think this also relies on the href element in each link being a “full” URL including the http:// and the domain name. If they are relative links (e.g. /home) you’ll want to use window.location.pathname instead of window.location.href.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We´re currently working on the following site: http://www.temminktrainingcoaching.nl/beta There's a lavalamp menu, with a
I`m currently working on a script, and I have the following situation. function somnicefunction()
I am currently working on a web application. I have a menu bar that
I'm currently working on this website and have just noticed a problem with the
I am currently working on a menu in jQuery, which has keyboard shortcuts for
I am currently working with a tab menu which cycles through automatically. Once I
I'm currently working on a site for a company and they wanted a menu
I am currently working with the following pseudo code block to fix a regex
I am currently working on a JS menu for a web app. It consists
I am working on a website that has a menu which behaves correctly on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.