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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:55:22+00:00 2026-05-26T02:55:22+00:00

I have a jquery dropdown text menu and when i click the choice i

  • 0

I have a jquery dropdown text menu and when i click the choice i choose to drop down, the image changes from red to gray, but when i press it again it stays grey and i want it to change back to red. I cant figure out how to make it go back to the red arrow when i close it.

The code is below.

    <script type="text/javascript">
    $(document).ready(function(){

    $('.serviceDesc').hide(); 
    //$('.serviceName:first').addClass('active').next().show(); 

    $('.serviceName').click(function(){
    if( $(this).next().is(':hidden') ) { 
    $('.serviceName').removeClass('active').next().slideUp(); 
    $(this).toggleClass('active').next().slideDown(); 
    }
    else {
    $(this).next().slideUp()
    }
    return false; 
    });

    });
    </script>

    <div id="servicesContainer">
      <h2 class="serviceName"><a href="#">
        <table>
          <tr>
            <td>Test</td>
            <td class="lasttd"><div></div></td>
          </tr>
        </table>
        </a> </h2>
      <div class="serviceDesc">
        <div class="block">
          <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud.</p>
        </div>
      </div>
      <h2 class="serviceName"><a href="#">
        <table>
          <tr>
            <td>Test</td>
            <td class="lasttd"><div></div></td>
          </tr>
        </table>
        </a></h2>
      <div class="serviceDesc">
        <div class="block">
          <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud.</p>
        </div>
      </div>
      <h2 class="serviceName"><a href="#">
        <table>
          <tr>
            <td>Test</td>
            <td class="lasttd"><div></div></td>
          </tr>
        </table>
        </a></h2>
      <div class="serviceDesc">
        <div class="block">
          <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud.</p>
        </div>
      </div>
      <h2 class="serviceName"><a href="#">
        <table>
          <tr>
            <td>Test</td>
            <td class="lasttd"><div></div></td>
          </tr>
        </table>
        </a></h2>
      <div class="serviceDesc">
        <div class="block">
          <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud.</p>
        </div>
      </div>
      <h2 class="serviceName"><a href="#">
        <table>
          <tr>
            <td>Test</td>
            <td class="lasttd"><div></div></td>
          </tr>
        </table>
        </a></h2>
      <div class="serviceDesc">
        <div class="block">
          <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud.</p>
        </div>
      </div>
      <h2 class="serviceName"><a href="#">
        <table>
          <tr>
            <td>Test</td>
            <td class="lasttd"><div></div></td>
          </tr>
        </table>
        </a></h2>
      <div class="serviceDesc">
        <div class="block">
          <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud.</p>
        </div>
      </div>
      <h2 class="serviceName"><a href="#">
        <table>
          <tr>
            <td>Test</td>
            <td class="lasttd"><div></div></td>
          </tr>
        </table>
        </a></h2>
      <div class="serviceDesc">
        <div class="block">
          <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud.</p>
        </div>
      </div>
      <h2 class="serviceName"><a href="#">
        <table>
          <tr>
            <td>Test</td>
            <td class="lasttd"><div></div></td>
          </tr>
        </table>
        </a></h2>
      <div class="serviceDesc">
        <div class="block">
          <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud.</p>
        </div>
      </div>
    </div>
    <style>   
    #servicesContainer {
    width: 485px;
    height: 400px;
    margin: 0 auto;
    margin-top: 20px;
    }
    h2.serviceName {
    margin: 0;
    margin-bottom: 5px;
    margin-top: 5px;
    background-image: url(http://i.imgur.com/nJRIr.png);
    background-position: right top;
    background-repeat:no-repeat;
    height: 29px;
    line-height: 24px;
    width: 480px;
    font-size: 18px;
    font-weight: bold;
    float: left;
    color:#000;
    }
    h2.serviceName a {
    color: #000;
    text-decoration: none;
    display: block;
    }
    h2.active {
    background-position: right bottom;
    }

    table { width: 450px; }
    table td { white-space: nowrap; }
    table td.lasttd { width: 100%; }
    table td.lasttd div { width: 100%;
    background-image:url(http://i.imgur.com/UnCTi.gif);
    background-repeat:repeat-x;
    height: 5px;
    margin-top: 3px;

    }

    .serviceDesc {
    margin: 0 0 10px;
    padding: 0;
    overflow: hidden;
    width: 480px;
    clear: both;
    }
    .serviceDesc .block {
    }
    .serviceDesc .block p {
    color: #413f44;
    margin: 0;
    font-size:18px;
    }
    </style>

I have a feeling it has to do with the jquery not calling back the css is that it?

Here is a working example http://jsfiddle.net/AtqvM/

  • 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-26T02:55:23+00:00Added an answer on May 26, 2026 at 2:55 am

    When a heading with a visible next section is clicked, you are just sliding up the next section and aren’t removing the ‘active’ class from the heading. Change:

    $(this).next().slideUp();
    

    to

    $(this).removeClass('active').next().slideUp();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have some index.php page.. after download jquery drop down menu,the link text like
I have a drop down menu made with Jquery. Right now, if you hover
I have a dropdown menu. Its height is animated with jQuery from 5px to
I have a (visibility:hidden) div with a Drop Down menu and a jQuery datepicker
I have an issue regarding to auto populating a select dropdown from jQuery/JSON data
I have created a dropdown menu with jquery: here Everything is ok but in
I have created a drop down with jQuery that can be seen here by
I have written a cascading drop down list using JQuery. The code that I
I have some custom dropdown css/jquery menus that are not overlapping (covering) some text
I have got a drop down menu which works fine but i want to

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.