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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:58:32+00:00 2026-06-17T15:58:32+00:00

I have most of this working – the sections expand when clicking a heading

  • 0

I have most of this working – the sections expand when clicking a heading (for example, Business Jet Traveler). What I am struggling with is this – when you expand a different section, THEN click on one of the sub-links, I want the OTHER section – the one you were just in – to collapse and become inactive (no light-colored background). Does this make sense?

http://jsfiddle.net/velcrobots/B6d35/

I’m trying to use closest() and siblings() but I guess I’m missing something. Any ideas?

HTML:

<div id="mk-menu">

        <div class="mk-ribbon"></div>

        <h1><?php print $yr; ?><br/>Media Kits</h1>
        <h2>Advertise With AIN</h2>            

    <div><!-- wrapper to separate menu items for jquery -->

        <div class="mk-menu-item">
            <a class="menu-head" id="ain-menu">Aviation International News</a>
            <ul id="ain-menu-sub" class="mk-submenu">
                <li><a href="#" name="ain-cal">Calendar</a></li>
                <li><a href="#" name="ain-rates">Print Rates</a></li>
                <li><a href="#" name="ain-orates">Online Rates</a></li>
                <li><a href="#" name="ain-specs">Print Specs</a></li>
                <li><a href="#" name="ain-ospecs">Online Specs</a></li>
            </ul>            
        </div>

        <div class="mk-menu-item">
            <a class="menu-head" id="bjt-menu">Business Jet Traveler</a>
            <ul id="bjt-menu-sub" class="mk-submenu">
                <li><a href="#" name="bjt-cal">Calendar</a></li>
                <li><a href="#" name="bjt-rates">Print Rates</a></li>
                <li><a href="#" name="bjt-orates">Online Rates</a></li>
                <li><a href="#" name="bjt-specs">Print Specs</a></li>
                <li><a href="#" name="bjt-ospecs">Online Specs</a></li>
            </ul>            
        </div>

        <div class="mk-menu-item">
            <a class="menu-head" id="cnd-menu">Convention News<br/>Daily Editions</a>
            <ul id="cnd-menu-sub" class="mk-submenu">
                <li><a href="#" name="cnd-cal">Calendar</a></li>
                <li><a href="#" name="cnd-rates">Print Rates</a></li>
                <li><a href="#" name="cnd-orates">Online Rates</a></li>
                <li><a href="#" name="cnd-specs">Print Specs</a></li>
                <li><a href="#" name="cnd-ospecs">Online Specs</a></li>
            </ul>            
        </div>

        <div class="mk-menu-item">
            <a class="menu-head" id="and-menu">Airshow News<br/>Daily Editions</a>
            <ul id="and-menu-sub" class="mk-submenu">
                <li><a href="#" name="and-cal">Calendar</a></li>
                <li><a href="#" name="and-rates">Print Rates</a></li>
                <li><a href="#" name="and-orates">Online Rates</a></li>
                <li><a href="#" name="and-specs">Print Specs</a></li>
                <li><a href="#" name="and-ospecs">Online Specs</a></li>
            </ul>            
        </div>

        <div class="mk-menu-item">
            <a class="menu-head" id="enews-menu">Emailed Newsletters</a>
            <ul id="enews-menu-sub" class="mk-submenu">
                <li><a href="#" name="enews-rates">Rates</a></li>
                <li><a href="#" name="enews-specs">Specs</a></li>
            </ul>            
        </div>

      </div><!-- end wrapper div to separate for jquery -->  

        <div class="mk-ribbon-end"></div>

    </div><!-- end #mk-menu -->

CSS:

#mk-menu {color:#FFF; background:#556B80; float: left; margin-top: -39px; position: relative; width: 204px; font-family: Verdana,Geneva,sans-serif; padding-bottom:20px}
.mk-ribbon {height:18px; width:25px; background:url(http://www.ainonline.com/sites/all/themes/ain_core/images/mk-ribbon.png) no-repeat; position:absolute; right:-25px}
.mk-ribbon-end {width:204px; height:51px; background:url(http://www.ainonline.com/sites/all/themes/ain_core/images/mk-ribbon-end.png) no-repeat; position:absolute; bottom:-51px}
#mk-menu h1 {font-family: Georgia, "Times New Roman", Times, serif;border-bottom: 1px solid #FFF; font-size: 25px; font-weight: bold; line-height: 32px; margin: 40px 15px 0; text-align: center; text-transform: uppercase;}
#mk-menu h2 {font-family: Georgia, "Times New Roman", Times, serif;font-size: 12px; margin: 6px 0 35px; text-align: center; text-transform: uppercase;}
a.menu-head {color: #FFF; display: block; font-size: 10px; margin: 10px 5px 0; padding: 5px; text-transform: uppercase; line-height:12px}
a.mk-selected, a.menu-head:hover {background: #6E8193; line-height:12px}
a.menu-head:hover {cursor:pointer; color:#FFF !important}
#mk-menu ul {font-size: 14px; margin: 10px 0 15px 60px;}
#mk-menu li {font-size: 12px; line-height: 16px;}
#mk-menu li a {color:#FFF; text-decoration:none}
#mk-menu li:hover, #mk-menu li a:hover, #mk-menu li.active {list-style:disc; font-weight:bold; color:#FFF !important}
.mk-submenu {display:none}

jQuery:

jQuery(document).ready(function(){

jQuery(".menu-head").click(function (a) {
    var myid = jQuery(this).attr("id");
    jQuery("#"+myid+"-sub").slideToggle(100);
    jQuery(this).toggleClass("mk-selected");
    a.preventDefault();
    });

jQuery(".mk-submenu li").click(function (b) {
    jQuery(".mk-submenu li").removeClass("active");
    jQuery(this).addClass("active");
    b.preventDefault();
    });

jQuery(".mk-submenu li a").click(function (c) {
    jQuery(this).closest(".mk-menu-item").siblings().removeClass("mk-selected");
    var myname = jQuery(this).attr("name");
    jQuery(".mk-section").hide();
    jQuery("#"+myname).show();
    c.preventDefault();
    });

});
  • 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-17T15:58:32+00:00Added an answer on June 17, 2026 at 3:58 pm

    Change this –

    jQuery(".mk-submenu li a").click(function (c) {
            var myname = jQuery(this).attr("name");
            jQuery(this).closest(".mk-menu-item").siblings().removeClass("mk-selected");
            jQuery(".mk-section").hide();
            jQuery("#"+myname).show();
            c.preventDefault();
            });
    

    to this –

    jQuery(".mk-submenu li a").click(function (c) {
            var myname = jQuery(this).attr("name");
            jQuery(this).parents('.mk-menu-item').siblings().find('.mk-submenu:visible').slideToggle();
            jQuery(".mk-section").hide();
            jQuery("#"+myname).show();
            c.preventDefault();
    
            });
    

    http://jsfiddle.net/B6d35/8/

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

Sidebar

Related Questions

I have viewed most of the other threads regarding this error but have not
I have this query to calculate the most common days of the week and
I have this string: B82V16814133260 what would be the most efficient way to get
I have never come across this issue but most recently I noticed that a
This post on SO answers most of the questions I have (much thanks to
I have a 2d array that looks like this: XX xx What's the most
This not a programming question but Most of the programmers using Eclipse should have
Most schemas' tables have last_updated_date and last_updated_by columns. I knew how to populate this
I have always wondered what's the best way to achieve this task. In most
I'm confused about this. Most of us have been told that there isn't any

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.