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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:10:05+00:00 2026-06-05T01:10:05+00:00

I’m trying to activate one link at a time. On the code I have,

  • 0

I’m trying to activate one link at a time. On the code I have, if I click on all links, all of them get activated. I’m using images, one for default, another image for hover and another one for active (three different images) no background colors are needed. These three images are different sizes. I also need the first link to be activated. How can I do this?

HTML:

<ul id="navStandard">    
<li class="a"><a href="#"></a></li>
</ul>

<ul id="navQuick">
<li class="a"><a href="#"></a></li>
</ul> 

<ul id="navSurvey">
<li class="a"><a href="#"></a></li>
</ul>

jQuery:

$('#navStandard li').append('<div class="hover" />');
$('#navStandard li').hover(function() {
    $(this).children('div').stop(true, true).fadeIn('1000');
}, function() {
    $(this).children('div').stop(true, true).fadeOut('1000');
}).click(function() {
    $(this).addClass('selectedStandard');
});


$('#navQuick li').append('<div class="hover" />');
$('#navQuick li').hover(function() {
    $(this).children('div').stop(true, true).fadeIn('1000');
}, function() {
    $(this).children('div').stop(true, true).fadeOut('1000');
}).click(function() {
    $(this).addClass('selectedQuick');
});


$('#navSurvey li').append('<div class="hover" />');
$('#navSurvey li').hover(function() {
    $(this).children('div').stop(true, true).fadeIn('1000');
}, function() {
    $(this).children('div').stop(true, true).fadeOut('1000');
}).click(function() {
    $(this).addClass('selectedSurvey');
});

CSS:

#navStandard {
width: 115px;
height: 72px;
margin-right: 0px;
margin-bottom: 0px;
    margin-top: 1px;
padding: 0px;
 }
#navQuick {
width: 100px;
height: 73px;
margin-right: 0px;
margin-bottom: 0px;
margin-top: 1px;
padding: 0px;

}
#navSurvey {
width: 110px;
height: 73px;
margin-right: 0px;
margin-bottom: 0px;
margin-top: 1px;
padding: 0px;

}

#navStandard li{
float:left;
 width:115px;
height:72px;
    position:relative;
   background-image: url(standard-img.jpg); 
background-repeat: no-repeat;
background-position: center center;
display: inline;
 }
 #navStandard li a{
  z-index:20; 
display:block;
width: 120px;          
height:72px;        
position:relative;
}
#navStandard li .hover {
position:absolute;
width:115px;
height:72px;
z-index:0;
left:0;
top:0;

display:none;
background-image: url(over-standard.jpg);
background-repeat: no-repeat;
background-position: center center;

 }
#navStandard li.selectedStandard {
background-image: url(active-standard.jpg);
background-repeat: no-repeat;
background-position: center center; 
}


#navQuick li{
 float:left; 
 width:100px;
 height:72px;     
    position:relative;
    background-image: url(quick-img.jpg); 
background-repeat: no-repeat;
background-position: center center;
display: inline;
}
#navQuick li a{
z-index:20; 
display:block;
width: 100px;          
height:72px;        
position:relative;
}
#navQuick li .hover {
position:absolute;
width:100px;
height:72px;
z-index:0;
left:0;
top:0;
display:none;
background-image: url(over-quick.jpg);
background-repeat: no-repeat;
background-position: center center;

}
#navQuick li.selectedQuick {
background-image: url(active-quick.jpg);
background-repeat: no-repeat;
background-position: center center; 
}

#navSurvey {
width: 110px;
height: 72px;
margin-right: 0px;
margin-bottom: 0px;
margin-top: 1px;
padding: 0px;

}
#navSurvey {
width: 110px;
height: 72px;
margin-right: 0px;
margin-bottom: 0px;
margin-top: 1px;
padding: 0px;

}


#navSurvey li{
float:left; 
 width:110px;
height:72px;    
    position:relative;
    background-image: url(survey-img.jpg); 
background-repeat: no-repeat;
background-position: center center;
display: inline;
}
#navSurvey li a{
z-index:20;
   display:block;
   width: 110px;          
   height:72px;        
   position:relative;
   }
#navSurvey li .hover {
position:absolute;
width:110px;
height:72px;
z-index:0;
left:0;
top:0;
display:none;
background-image: url(over-survey.jpg);
background-repeat: no-repeat;
background-position: center center;

}
#navSurvey li.selectedSurvey {
background-image: url(active-survey.jpg);
background-repeat: no-repeat;
background-position: center center; 
}
  • 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-06-05T01:10:07+00:00Added an answer on June 5, 2026 at 1:10 am

    If you are trying to only one link active, you will need to remove the selected state from all the other li elements before you add the selected to the one user clicked on.

    Something along the lines of

    $('#navSurvey li').hover(function() {
        $(this).children('div').stop(true, true).fadeIn('1000');
    }, function() {
        $(this).children('div').stop(true, true).fadeOut('1000');
    }).click(function() {
        $("#navStandard li").removeClass('selectedStandard');
        $("#navQuick li").removeClass('selectedQuick');
        $(this).addClass('selectedSurvey');
    });
    

    However, I suggest you have a generic selected state rather than specific for each element. In your CSS, you will be able to target them with the Id, but it will keep your JS cleaner and less repetitive. For example

    $('ul li').hover(function() {
        $(this).children('div').stop(true, true).fadeIn('1000');
    }, function() {
        $(this).children('div').stop(true, true).fadeOut('1000');
    }).click(function() {
        $("ul li").removeClass('selected');
        $(this).addClass('selected');
    });
    

    You will be able to trigger the anchor click using JQuery trigger

    $("#navStandard li a").trigger("click");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a text area in my form which accepts all possible characters from
I have thousands of HTML files to process using Groovy/Java and I need to
I am trying to loop through a bunch of documents I have to put
I'm making a simple page using Google Maps API 3. My first. One marker
I am trying to understand how to use SyndicationItem to display feed which is

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.