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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:41:49+00:00 2026-05-28T14:41:49+00:00

i’ve been researching this for about 3 hours now with no gravy so I

  • 0

i’ve been researching this for about 3 hours now with no gravy so I finally caved and decided to ask here. I have a jsFiddle i hope someone can look at and help me.

Essentially what is happening is that I am trying to create a simple dropdown menu and it’s working great except for one small issue.

When the submenu comes down, you have to actually mouse over the submenu in order for it to fadeout. You are just on the main link that activates the submenu, and you leave the main link to the right, left, or top, the submenu stays there static.

I tried to write my own little script (which I commented out on the jsFiddle for you to see) with my basic knowledge of JS and it would work if I could get it to only trigger when leaving the link from the top, left and right sides. When you leave the main link and try to access the submenu, the submenu disappears before your mouse even gets to it.

I understand why this is happening (I’m telling it to disappear when it leaves the class .dropdown which is the class applied to main link.) but I don’t know how to fix it. I’m pretty new to JS.

Anyways, sorry if I am confusing you, here is the JS fiddle to get a better grasp.

See if you can see the problem with my code commented out. It will not leave the submenu if you leave the “Products” link to the left, right and top.

Then you can uncomment my code and see why that isn’t working.

http://jsfiddle.net/4wzmf/8/

  • 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-28T14:41:51+00:00Added an answer on May 28, 2026 at 2:41 pm

    I think your jQuery code was a bit more complicated than it should have been.

    Also, you had a strange structure going on with your main navigation set up. Instead of on main <ul> and child <li> you had every link as its own <ul>. You had the id of “mainnav” on every <ul>, which was kind of strange, and it isn’t valid code. (Side note: You can only use an ID ONCE on a page. If you’re going to use it multiple times, make it a class.)

    I also cleaned up some of your CSS the way I like to do it. It doesn’t mean it’s better than what you had.

    The HTML:

    <ul id="mainnav">
        <li><a href="#">news</a></li>
        <li><a href="#">contact</a></li>
        <li><a href="#">rentals</a></li>
        <li><a href="#">services</a></li>
        <li class="dropdown"><a href="#" >products</a>
            <ul class="sublinks">
                <li><a href="#">link 1</a></li>
                <li><a href="#">link 2</a></li>
                <li><a href="#">link 3</a></li>
                <li><a href="#">link 4</a></li>
            </ul>
        </li>
        <li><a href="#">about</a></li>
        <li class="home"><a href="#">home</a></li>    
    </ul>
    

    And the jQuery

    $(function() {
       $('.dropdown').mouseenter(function() {
           $('.sublinks').slideDown(300);
       });
    
       $('.dropdown').mouseleave(function() {
           $('.sublinks').slideUp(300);
       });
    });
    

    Anyway, I made a js fiddle and it works well.

    http://jsfiddle.net/QhkUn/23/

    Basically, what I did was clean up your navigation structure. If you create a nested <ul> of “sublinks” within the <li class="dropdown"> then you can simply say to do everything on mousenter/mouseleave of the “dropdown” main link <li>. This way, it slides up when you mouse out of the “sublinks” ul, because it is a child of “dropdown” – does that make sense?

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
This could be a duplicate question, but I have no idea what search terms
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I have been unable to fix a problem with Java Unicode and encoding. The
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

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.