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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:57:19+00:00 2026-06-17T18:57:19+00:00

I have a rather long nav ( .nav-main ) as a child div within

  • 0

I have a rather long nav (.nav-main) as a child div within a fixed header (header). When the nav is displayed via jQuery .toggle(), the content is longer than the window and thus does not scroll. I am trying to figure out how I can apply a scrollbar (preferably in CSS) to the child div within the fixed nav:

    <header class="clearfix">

                <nav class="nav-main">
                    <button>Open Topics</button>
                    <ul>
                        <li><a href="">Section 1</a></li>
                        <li><a href="">Section 2</a></li>
                        <li><a href="">Section 3</a></li>
                        <li><a href="">Section 4</a></li>
                        <li><a href="">Section 5</a></li>
                        <li><a href="">Section 6</a></li>
                        <li><a href="">Section 7</a></li>
                        <li><a href="">Section 8</a></li>
                        <li><a href="">Section 9</a></li>
                        <li><a href="">Section 10</a></li>
                        <li><a href="">Section 11</a></li>
                        <li><a href="">Section 12</a></li>
                        <li><a href="">Section 13</a></li>
                        <li><a href="">Section 14</a></li>
                        <li><a href="">Section 15</a></li>
                        <li><a href="">Section 16</a></li>
                        <li><a href="">Section 17</a></li>
                        <li><a href="">Section 18</a></li>
                        <li><a href="">Section 19</a></li>
                        <li><a href="">Section 20</a></li>
                    </ul>
                </nav><!--end nav-main-->
</header>

<div id="main">
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div><!--end main-->

The SCSS/CSS:

header{

    background-color: #ccc;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;


    .head-wrap{
        position: relative;
        height: 50px;
    }

    .nav-main{

        position: relative;

        button{
            float: right;
            margin-top: 10px;
            margin-right: 70px;
            background-color: pink;
        }

        ul{
            display: none;
            background-color: #333;
            top: 50px;
            position: absolute;
            width: 100%;
            z-index: 2;
            overflow: auto;

            li{
                background-color: #333;

                a{
                    color: #fff;
                    text-decoration: none;
                    padding:10px 50px;
                    display: block;
                }
            }
        }
    }
}

#main{
    margin-top: 50px;

    p{
        margin-bottom: 20px;
    }
}

And my .toggle() JS:

$(".nav-main button").click(function(event){
        $(".nav-main ul").toggle();
        event.preventDefault();
});

Here is a fiddle. Please shrink the window small enough so that when the nav is displayed by clicking on the button, the content is cut off, wanting a scrollbar:

http://jsfiddle.net/HAUcU/1/

  • 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-17T18:57:20+00:00Added an answer on June 17, 2026 at 6:57 pm

    You need to set a height attribute to the .nav-menu ul element. This can be set statically or use a script to set it based on the window height.

    JSFiddle

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

Sidebar

Related Questions

I have a rather long running javascript code which adds a new div element
I have found that writing PHP code within classes can become rather long: $this->parser->parse_syntax($this->get_language_path($this->language),
I have a rather long switch-case statement. Some of the cases are really short
I have a task that takes a rather long time and should run in
I have some rather long (~150 character) django queries. What's the preferred way to
I am planning to convert a rather long shell script I have into an
I have some rather long string containing just about anything that I want to
I have an AsyncTask that handles a rather long download, using HttpClient. I'd like
I have the following cells in a markdown table: something something that's rather long
I have a very odd problem with javascript. My code is rather long so

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.