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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:58:46+00:00 2026-05-23T17:58:46+00:00

I want to make drop-down menu with jquery (here’s the according jsFiddle ). HTML:

  • 0

I want to make drop-down menu with jquery (here’s the according jsFiddle).

HTML:

<ul id="mainmenu">
  <li><a href="http://myszki/">Aktualności</a></li>
  <li class="parent item13"><a href="/start.html">Galerie</a>
    <ul>
      <li><a href="/start/plenery.html">Plenery</a></li>
    </ul>
  </li>
  <li class="parent"><a href="/start.html">Galerie</a>
    <ul>
      <li><a href="/start/plenery.html">Plenery</a></li>
    </ul>
  </li>
</ul>

JS:

$(document).ready(function()
{
     var sub = 'ul#mainmenu li.parent ul';  
     var parents = 'ul#mainmenu li.parent';
     var count = 0;

     $(sub+", "+parents).mouseenter(
     function()
     {         
         $(this).children('ul').addClass('submenu');

         var width = $(parents).width();


         count++;
         $(sub).find('a').css({'width':width}); //ustawienie parametrow wyswietlana

         if ($(sub).is(':visible'))
             {
                 $(sub).stop(true, true).show(); //pokaz
             }
         else
             {
                $(this).find('ul.submenu').stop(true, true).delay(800).slideDown('fast'); 
             }

     }).mouseleave(
         function ()
         {
             count--;

             if (!count)
                 {                     
                     $(sub).stop(true, true).slideUp('fast'); 

                 }
         });

});

CSS:

ul#mainmenu {
    width: 990px; height: 35px;    
    background:#000;
    clear: both;




} 
ul#mainmenu  li {float:left; position: relative;   } 
ul#mainmenu  li a {
    color: #FFFFFF;
    font-size: 14px;
    font-weight: bold;
    text-decoration: none;
    text-transform: uppercase;    
    line-height: 35px; padding: 0 19px 0 20px;
    display: block;

    z-index: 150;
    position: relative;




}
ul#mainmenu  li.backLava {background: url(../images/arrow_menu.png)  no-repeat center bottom #202223; z-index: 20;}
ul#mainmenu  li span {background: url(../images/star.png) left no-repeat; padding-left: 15px; z-index:50;}





ul#mainmenu li.parent ul {display: none; position: absolute; top:35px; }
ul#mainmenu li.parent ul li {border-bottom:1px solid darkgrey; border-left:1px solid darkgrey; border-right:1px solid darkgrey;}
ul#mainmenu li.parent ul span {background: none; padding-left: 4px;}
ul#mainmenu li.parent ul li a {text-decoration: none; background:#eeeeee; color: #000; font-size: 12px; line-height: 25px; display: block; padding: 0px; text-transform: none; opacity:0.8;filter:alpha(opacity=80); font-weight: normal; }
ul#mainmenu li.parent ul li.hover a { color: #000; }

Problem is when I hover one of the parent button everyone parrent button expands. What should I change in my code?

  • 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-23T17:58:47+00:00Added an answer on May 23, 2026 at 5:58 pm

    I think You have a very complicated code. It should be like this

    $(document).ready(function() {
    
        $('#mainmenu > li').hover(
            function () {
                $(this).find('ul').stop(true, true).addClass('submenu').slideDown();
            },
            function () {
                $(this).find('ul').stop(true, true).removeClass('submenu').slideUp();
            }
        );
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im trying to make an easy drop down menu plugin for jquery but for
I was following a dropdown menu tutorial: http://net.tutsplus.com/tutorials/html-css-techniques/how-to-create-a-drop-down-nav-menu-with-html5-css3-and-jquery/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:%20nettuts%20(NETTUTS)&utm_content=Netvibes What I really want to do
How to make the File menu drop down on form load ? I want
I want to make a dropdown menu like delicious has at this http://delicious.com/search?context=all&p=sql&lc=1 page.
I want to make a drop-down list from scratch. Can anyone please tell me
I want to make a dropdown menu for my website with jquery... a couple
I'm using the following code for a drop down menu but I want the
I'm trying to make a simple CSS drop down menu that when you mouse
Brain freeze here. What I want to do is have the Suckerfish drop down
I want to make the selected option appear in the middle of a drop-down.

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.