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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:32:32+00:00 2026-06-15T22:32:32+00:00

I have an accordion menu that the active link drops down the menu, loads

  • 0

I have an accordion menu that the active link drops down the menu, loads an external page into a div, then changes the banner on the same click. I have everything working except for the banner image changing out. I thought I had the code right, but something seems to be missing, and I can’t figure it out.

Here is my html:

<section id="commercialBanner">
    <img src="images/catalog/indoorBanner.jpg"/>
</section>  

<section id="accordionNav">
    <ul id="nav">
        <li id="indoorEntrance" class="category"><a class="ext" id="indoor" href="montage.html">Indoor Entrance</a>
            <ul id="indoorEntranceSubmenu" class="sideSub">
                <li><a href="montage.html" class="ext">Ecomat Squares</a></li>
                <li><a href="gatekeeper.html" class="ext">Gatekeeper</a></li>
                <li><a href="absorba.html" class="ext">Absorba</a></li>
            </ul>
        </li>
        <li id="outdoorEntrance" class="category"><a id="outdoor" class="ext" href="aquaFlow.html">Outdoor Mats</a>
            <ul id="outdoorEntranceSubmenu" class="sideSub">
                <li><a href="aquaFlow.html" class="ext" id="aquaflow">AquaFlow</a></li>
            </ul>
        </li>
    </ul>
    <section id="catalog"></section>

Here is my Script:

$('a.ext').click(function (event){
        event.preventDefault(); 
        $('#catalog').load(this.href);
});

$('.category > a').click(function(evt) {                 
    if ($(this).attr('class') != 'active'){
        $('#nav li ul').hide();
        $(this).next().show()
        // $(this).next('li > a').trigger('click')
        $('#nav li a').removeClass('active');
        $(this).addClass('active');
    };
    if ($('#indoor').attr('class') == 'active'){
        $("#commercialBanner img").attr("src", "images/catalog/indoorBanner.jpg");
    };  
    if ($('#outdoor').attr('class') == 'active'){
        $("#commercialBanner img").attr("src", "images/catalog/outdoorBanner.jpg");
    };  
});
  • 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-15T22:32:33+00:00Added an answer on June 15, 2026 at 10:32 pm

    You seem to be checking the class attribute incorrectly – you have more than one class on an element, so:

    $('#indoor').attr('class') is 'ext active' or 'ext'
    

    As noted by @epascarello: use hasClass(“active”).

    See this:

    jQuery's attr – return multiple classes not just the 1st

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

Sidebar

Related Questions

I have an auto-scrolling thumbnail DIV that I want to insert into an accordion
In my master page I have a menu that uses jquery ui accordion. What
I have a jquery accordion style menu that I'd like to add some shortcut
I have a vertical accordion menu that opens on hover, stays open and closes
So, I have an accordion menu and in each div I have a red
I have a simple accordion menu using jQuery. When I click a link inside
I'm new to jQuery. I have an accordion menu that I am trying to
I have an accordion menu working on the page, but when I click one
I really cannot find the solution on other questions! I have that accordion menu
I have a simple menu on a web page, based on the jQuery Accordion.

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.