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 6825857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:04:50+00:00 2026-05-26T22:04:50+00:00

My navigation has 5 buttons [Home, About, Services, Events, Contact] and each button has

  • 0

My navigation has 5 buttons [Home, About, Services, Events, Contact] and each button has a background image of “blue-button.png”. I want to switch it to “white-button.png” when the user is in that section. I wish it were as simple as a:active, but it’s not and i’ll explain why;

All of the content is displayed in an overlay. The way the website is built, you never leave the index page, but the content is loaded into the index page. This is why the a:active doesn’t work.

Now for example, when the user opens the “About” page, the content (which I will call “About Main”) appears, and has links to “About-Me”, “About-You”, and “FAQ”. I want the “About” button to change background images (to white) whenever the user is in any of the areas that pertain to “About” (About Main, About me, About you, FAQ)… I also want the button to change back to blue when the user goes to a different section (EX: Contact) and then have the Contact button become white.

The only way I’ve noticed to tell where the user is, is that the overlay they are on has a css style of display:block while all the others are hidden with display:hidden…

So, I was thinking javascript similar to this:

if (About Main, About Me, About You, FAQ) is display:block
{ $(".about").css('background-image', 'url(../img/white-button.png)' }
else
{ $(".about").css('background-image', 'url(../img/blue-button.png)' }

if (contact) is display:block
{ $(".contact").css('background-image', 'url(../img/white-button.png)' }
else
{ $(".contact").css('background-image', 'url(../img/blue-button.png)' }

the navigation buttons have Classes like:
<a class="about">
<a class="contact">

while the overlays have IDs like:
<div class="simple_overlay" id="about">
<div class="simple_overlay" id="contact">

I know it’s a lot of information but hopefully someone can help me clear up the specifics, I’m not very good with javascript…
Heres a link to the site if you want to look to get a better understanding

Thank you so much for your time in advance, This one is really killing me!

  • 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-26T22:04:50+00:00Added an answer on May 26, 2026 at 10:04 pm

    You’re better off just adding and removing a .selected class from each of your links when you click on them. Then set the .selected class to have a background image of white-button.png. You would need to add click handlers to your navigation links so it would first remove any existing .selected classes from all of them, and then add .selected to the link you clicked on.

    CSS

    .navigation a.selected
    {
      background-image: url(../img/white-button.png);
    }
    

    Javascript – I see you’re using jQuery so that makes this easy. Add the code below to your initialization section. I haven’t tested this script but it should be pretty close.

    // Add click event handler to all navigation links
    $('.navigation a').click(function() {
      // First remove selected class from all navigation links
      $('.navigation a').removeClass('selected');  
      // Now add the selected class to the current link
      $(this).addClass('selected');
    });
    

    EDIT: I tweaked this a little and added a jsfiddle for you to see it in action:
    http://jsfiddle.net/VCaSV/

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

Sidebar

Related Questions

iPhone application, which has two buttons -right side- of Navigation Bar title. I want
I have group of section each has prev and next navigation buttons to navigate
I have a navigation controller which also has a table view. I want to
I want to build a navigation screen, just like installation shields has (next/previous stuff),
Got a Navigation, by Example: Home News Contact When choosing one Navigationlink, on the
My jquery mobile layout has a navigation bar that contains both buttons. When click
So Im setting up a menu that has different background :hover colors. The buttons
Background: App has a shake to go home feature. Home view Only supports portrait.
My app has 3 categories of buttons, I want to have a tabbed panel
I have created navigaton view using Sencha touch 2. Navigation view has list component

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.