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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:30:43+00:00 2026-06-15T23:30:43+00:00

I am new to jQuery and am not sure how to solve this jQuery

  • 0

I am new to jQuery and am not sure how to solve this jQuery dropdown problem I am having.

When you hover over one of the links, the dropdown menu works fine, however I have added a second dropdown to the navigation, and now when you hover one of the links, both the dropdowns are revealed. I only want the current dropdown menu to be revealed.

Here is my code, and a link to jsfiddle http://jsfiddle.net/K2Zzh/1/…

$('.dropdown ul').hide();   
$('.dropdown').hover(function(){
    $('.dropdown ul').stop().slideDown(500);
    },function(){
    $('.dropdown ul').stop().slideUp(200);
});

I know why it is doing what it is doing, and I know I should be using a this somewhere but I am not sure where.

  • 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-15T23:30:44+00:00Added an answer on June 15, 2026 at 11:30 pm

    You need to only target the relevant list, similar to this:

    var $dropdown;
    
    $('.dropdown ul').hide();
    $('.dropdown').hover(function() {
        $dropdown = $(this).find('ul');
        $dropdown.stop().slideDown(500);
    }, function() {
        $dropdown.stop().slideUp(200);
    });​
    

    DEMO

    The only reason why I’m using a variable above is so you don’t have to traverse twice for the same dropdown, which is a good habit to get into.

    You can off course do this too:

    $('.dropdown ul').hide();
    $('.dropdown').hover(function() {
        $(this).find('ul').stop().slideDown(500);
    }, function() {
        $(this).find('ul').stop().slideUp(200);
    });​
    

    Also, the reason I used find() instead of children() is because children() only travels a single level down the DOM tree while find() can traverse down multiple levels to select descendant elements.

    In your particular case childrend() seems absolutly fine though as you are only 1 level down.

    Edit
    For completeness sake, if you want to use slideToggle() within a single hover function you can do as seen in another answer:

    $('.dropdown').hover(function() {
        $(this).find('ul').stop(true, true).slideToggle(500);
    }
    

    Note though that when using this option you might need to include true, true in your stop() call to prevent the sliding menu from lagging and possibly becoming reversed.

    • clearQueueA Boolean indicating whether to remove queued animation as
      well. Defaults to false.
    • jumpToEndA Boolean indicating whether to
      complete the current animation immediately. Defaults to false.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm brand new to jquery and am not even sure if I'm referring correctly
Having trouble here and not quite sure how to do it. I've attempted jQuery
Sorry i am so new to jQuery and not sure how to do that.
I'm basically new to jquery so I'm not sure I did the best way
EDIT: new error: Error Jquery not defined line: 208 Line 208 in this code:
I am new to jQuery and jsTree and I am not sure why I
I'm not sure if this is a bug or just some crazy new thing
I am new to jquery mobile frame work.On my observation i am not able
im new to jquery and javascript.. Here is the code, this is a sample,
Very new to JQuery and MVC and webdevelopment over all. I'm now trying 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.