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

  • Home
  • SEARCH
  • 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 5992351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:31:09+00:00 2026-05-22T23:31:09+00:00

I have a static menu in a common header file. Whenever I visit any

  • 0

I have a static menu in a common header file. Whenever I visit any of the pages by clicking on the links in the menu, I need an image over that clicked link as an indicator of the activated link.

below is the HTML of menu I am using

<ul id="in-menu">
    <li><a href="unleashing-your-heart" >home</a></li>
    <li><a href="fromdaniella" >from Daniella</a></li>
    <li><a href="material-list" >material list</a></li>
    <li><a href="program" >program</a></li>
    <li><a href="testimonials-2" >testimonials</a></li>
    <li><a href="#">login</a></li>
</ul>

How to use jQuery or javascript to make the desired functionality work?

  • 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-22T23:31:09+00:00Added an answer on May 22, 2026 at 11:31 pm

    You don’t need javascript/jQuery for this

    What you can do is to give each of your pages a unique ID or Class on the <body> element or main container div somewhere near the top of the the HTML structure anyway.. then give each of the links in your menu a unique ID or class too (if using classes they can be the same as the first one)

    e.g.

    <body class="nm-unl">
       <ul id="in-menu">
         <li class="nm-unl"><a href="unleashing-your-heart" >home</a></li>
         <li class="nm-dan"><a href="fromdaniella" >from Daniella</a></li>
         <li class="nm-mat"><a href="material-list" >material list</a></li>
         <li class="nm-pro"><a href="program" >program</a></li>
         <li class="nm-tes"><a href="testimonials-2" >testimonials</a></li>
         <li class="nm-log"><a href="#">login</a></li>
       </ul>
    </body>
    

    So on your Home page the body class might be nm-unl and your login page would have body class nm-log etc.. the menu itself never changes so it can still be in a common file

    Then in the CSS each link can be specifically targeted.. so say your plain link does not have an image, but the :hover and your “current” pages do

    #in-menu a {background: none;}
    
    #in-menu a:hover {background: url(image.png) no-repeat top center;}
    

    Then you would group the new/specific selectors into the hover rule selectors, those rules are then more specific than the ordinary #in-menu a {} rule, and also they will only ever apply to your “current page link” i.e. when the two classes are the same on a page

    .nm-log #in-menu .nm-log a,
    .nm-tes #in-menu .nm-tes a,
    .nm-pro #in-menu .nm-pro a,
    .nm-mat #in-menu .nm-mat a,
    .nm-dan #in-menu .nm-dan a,
    .nm-unl #in-menu .nm-unl a,
    #in-menu a:hover {background: url(image.png) no-repeat top center;}
    

    You still need the #in-menu ID in the selector as well as the two classes because otherwise the selector will not have enough weight to override the default rule


    A jQuery solution would work in a similar way, the logic would be the same. You would still need a unique page indicator i.e. a body class or ID then you would check the body ID/Class and add a current class to the relevant, matching link.

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

Sidebar

Related Questions

We have a static method in a utility class that will download a file
I am designing a website and I want to have a static menu at
I have several service classes that have static methods and offer a service to
I got a Utility module since VB.NET doesn't have static class like C# and
I have a static library written in C++ and I have a structure describing
I have several static factory patterns in my PHP library. However, memory footprint is
I have a static class that I would like to raise an event as
I have some static images in a folder on my IIS 6-based website that
I have a static library *.lib created using MSVC on windows. The size of
I have a static linkable library of C and Fortran routines compiled and linked

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.