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

  • Home
  • SEARCH
  • 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 8705541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:23:16+00:00 2026-06-13T03:23:16+00:00

I am using the following for a dropdown menu. It works great, however, I

  • 0

I am using the following for a dropdown menu. It works great, however, I can’t figure out how to get an open dropdown to slideUp if somewhere in the body is clicked, or another dropdown is clicked.

$(document).ready(function () { 
$('.nav li').click(function() {

  var slideToggle = this;
  if ($('ul', this).is(':visible')) {
      $('ul', this).slideUp(function() {
          $(slideToggle).removeClass('active');
      });
  }
  else {
      $('ul', this).slideDown();
      $(slideToggle).addClass('active');
  }
});
});

View it action here: http://jsfiddle.net/Ngh5C/1/

What would be the easiest way to go about what i’ve asked?

  • 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-13T03:23:17+00:00Added an answer on June 13, 2026 at 3:23 am

    Take advantage of event bubbling and bind a click handler to a suitable parent container (e.g. body). Check the target in the handler and if it isn’t one of your menus, use a selector to find the open menu and close it.

    Here’s a simple example as a starting point:

    http://jsfiddle.net/Ngh5C/6/

    Try this fiddle to keep only one open at a time:

    http://jsfiddle.net/Ngh5C/7/

    If you really only want to close the neighbors of the item clicked (which is an odd requirement), then this works:

    http://jsfiddle.net/Ngh5C/8/

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

Sidebar

Related Questions

I'm using the following code to cause a ul based dropdown menu to open,
Ok so i am using the following jquery dropdown menu. I found this code
I have a asp.net sitemap with single level dropdown menu. I am using following
I'm using the following HTML/JS code to display a 2nd dropdown menu below the
I am using the following well-known CSS code to get a drop down menu
I've made a very simple dropdown menu using jQuery slideup and slidedown for the
I have the following dropdown menu how can i redirect each menu to corresponding
I have found a tutorial on some dropdown menu using jquery. It works fine
Using following code I try to get updated list of checkbuttons' corresponding text values,
I am using following code to get bitmap from url. This function is used

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.