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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:59:11+00:00 2026-05-29T06:59:11+00:00

I have a question regarding jQuery. I have multiple images that are, in essence,

  • 0

I have a question regarding jQuery. I have multiple images that are, in essence, the same. The difference is that one of the images (let’s call it the ‘active’ image) is a used as a side navigation bar which triggers “animated collapse” of the multiple DIVs in the Div to the right. For this item which is clicked (and triggers the animated collapse) I am wanting to change the background image which has been defined in CSS.

I’d love it if I could get the “active” background/class to be displayed on the one, while the “inactive” icons revert to the “inactive status” onclick. As you select different items in the nav bar, each one changes it’s background/class to the active designation, along with triggering the animated collapse effect.

Right now only the animatedcollapse event works, though the inactive status

Here’s the HTML that I’m working with:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="animatedcollapse.js"></script>
<script type="text/javascript">
animatedcollapse.addDiv('one', 'fade=1,speed=400,group=content,hide=0')
animatedcollapse.addDiv('two', 'fade=1,speed=400,group=content,hide=1')
animatedcollapse.addDiv('three', 'fade=1,speed=400,group=content,hide=1')
animatedcollapse.init()
</script>
<script type="text/javascript">
$('a.toggle').click(function () {
  $('a.toggle.select').removeClass('active');
  $(this).addClass('active');
});
</script>
<style type="text/css">
a.toggle {
    background-image: url(images/contentnav_inactive.png);
    width: 275px;
    height: 41px;
    background-position: left top;
    background-repeat: no-repeat;
    float: left;
    margin-top: 5px;
    margin-bottom: 5px;
}
a.toggle.active {
    background-image: url(images/contentnav_active.png);
    width: 275px;
    height: 41px;
    background-position: left top;
    background-repeat: no-repeat;
    float: left;
    margin-top: 5px;
    margin-bottom: 5px;
}
a.contentheader {
    height: 25px;
}
</style>
</head>
<body>
<div class="content">
        <div class="contentnav">
        <a class="contentheader" href="javascript:animatedcollapse.toggle('one')" id="toggle1_TGLink"><img src="images/contnav_header_business.png" width="252" height="25" style="margin: 2px 4px" /></a>
        <a class="toggle" id="toggle2_TGLink" href="javascript:animatedcollapse.toggle('two')"><img src="images/contentnav_text_busauto.png" width="269" height="41" /></a>
        <a class="toggle" href="javascript:animatedcollapse.toggle('three')" id="toggle3_TGLink" ><img src="images/contentnav_text_bop.png" width="269" height="41" /></a>
</div>
      <div class="toggle></div>
      <div class="contenttext">
            <div id="one" class="TG_hidden"><h1>Business Insurance Overview</h1>
                <hr />
       </div>
            <div id="two" class="TG_hidden"><h1>Business Auto</h1>
                <hr />

            </div>
            <div id="three" class="TG_hidden"><h1>Business Owners Insurance (BOP)</h1>
            <hr />

        </div>
      </div>
</body>
</html>
  • 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-29T06:59:12+00:00Added an answer on May 29, 2026 at 6:59 am

    Try this code

    $('a.toggle').click(function () {
        $('a.toggle').removeClass('active');
        $(this).addClass('active');
    });
    

    I’ve just removed .select class

    “animatedcollapse.js” line 107, you should remove “@” so this line should have been

    var $allcontrols = $('[rel^="collapse-"], [rel^="expand-"], [rel^="toggle-"]')

    also you should wrap your selector in $(document).ready as

    $(document).ready(function () {
        $('a.toggle').click(function () {
            alert("active");
            $('a.toggle').removeClass('active');
            $(this).addClass('active');
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a question regarding static function in php. let's assume that I have
I have one question regarding using JQuery UI tab control in the asp.net mvc
Again I have a question regarding this plugin: http://t.wits.sg/2008/06/20/jquery-progress-bar-11/ What I want to achieve
I have one question regarding domain account. I have one domain controller where all
I have a Question regarding Jquery ui dialog boxes. What i have/i did: I
I have a question regarding syntax that I've been coming across in JavaScript. What
i have a question regarding Jquery <select id=thechoices> <option value=0>Select Box</option> <option value=box1>Box 1</option>
I have a basic question regarding jQuery. I have a static time-selection box IE:
I have a question regarding CSS3 Gradients and a plugin for jQuery called color
Have a question regarding URL and jQuery. Can I specify URL to tell jQuery

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.