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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:23:57+00:00 2026-05-22T23:23:57+00:00

i am trying to implement jquery’s toggle method to make a dropdown menu, it

  • 0

i am trying to implement jquery’s toggle method to make a dropdown menu, it actually works just fine, the only problem is that the dropdown menu pushed its parent container and it seems like it add some height to it, it kinda hard for me to say this but let me show some of my html and css

Html:

<div id="header_container">
    <h1>This is Header</h1>
    <div id="personal_menu">
        <ul>
            <li>
            Welcome back user!
            </li>
            <li class="main_link">
                <a href="#">My links</a>
                <ul class="sublink" style="display: block;">
                    <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="#">Logout</a>    </li>
        </ul>
    </div>
</div>

CSS

#header_container{
    width:960px;
    overflow:auto;
    padding: 10px 15px;
    margin: 0 auto;
}
#header_container{
    background:#BED308;
    height:218px;
    -moz-border-radius: 0 0  40px 40px;
    border-radius: 0 0  40px 40px;
}
#personal_menu{
    overflow: auto;
    position: relative;
    right: 0;
    top: 135px;
    width: 100%;            
}
        #personal_menu ul, #main_menu ul{ list-style-type:none;}
        #personal_menu ul{
            float: right;
            margin-top: 5px;
        }
            #personal_menu li{
                float: left;
                text-align: center;
            }
            #personal_menu li{
                margin: 0;
                padding: 3px 5px;
            }
                #personal_menu li a{
                    color: #fff;
                    text-decoration:none;
                }
                #personal_menu li a:hover{
                    text-decoration:underline;
                }
                #personal_menu ul li ul {
                    display: none;
                    position: absolute;
                    width: 160px;
                    border: 1px solid #ccc;
                    padding: 10px 0;
                    z-index: 1000;
                }

and jquery:

$(function() {  
    $(".main_link").click(function(){
        $(".sublink").toggle();
    });
});

so when i click the main_link class, the toggled sublink stays inside the header container making my header scrollable, i have tried to put some z-index rule to my sublink because i figure that it need to be on top of everything else but still no luck, please help.

Thanks

  • 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-22T23:23:58+00:00Added an answer on May 22, 2026 at 11:23 pm

    Try to delete overflow:auto. If you have undesired scroll, the problem must be here.

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

Sidebar

Related Questions

I am trying to implement this jQuery auto complete function but the problem is
I'm trying to implement a jquery menu in a silverlight web application. Since I'm
Good evening all, I'm trying to implement jquery table sorter, all seems fine and
I am trying to implement the jQuery Deferred.pipe() method for the following scenario: Add
Has anyone been able to implement the JQuery grid plugin, jqGrid? I'm trying to
I've been trying to implement jQuery's grid function in my Asp.Net MVC app. I'm
i'm trying to implement the jquery autocomplete plugin. I've got it up and running,
I'm trying to implement a jQuery slider with increments. I've gone from, the actual
I am trying to implement the Jquery datepicker using a google hosted theme. But
I'm trying to implement a JQuery script to process some areas inside an image

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.