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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:05:05+00:00 2026-05-24T18:05:05+00:00

I am trying to create div that contains scrollable content. To do this I

  • 0

I am trying to create div that contains scrollable content. To do this I created a parent div that hides overflow content and I have two divs that allow users to scroll through the child content. The problem is that my two divs that allow users to scroll are moving when they are clicked. I would like their position to stay fixed within the parent div.

If that does not make sense please take a look at the jsFiddle below. When you click the text that says “Down!” you will see everything on the page (including the “Down!” text) move down. I would like “Down!” to stay where it is.

http://jsfiddle.net/4ecA7/

Here is what I have tried so far:

<div id="container">
    <div id="up">UP!</div>
    <div id="down">DOWN!</div>
    <div id="content">
        Scrolling content       
    </div>
</div>

Css:

#container
{
 height:200px;
 width:400px;   
 position:relative;
 overflow:hidden;
}

#up
{
    position:absolute;
    top:3px;
    left:3px;
}
#down
{
    position:absolute;
    bottom:3px;
    left:3px;
}
#content
{
 left:80px;   
 position:relative;
}

jQuery:

    $(document).ready(function () {

        $("#up").click(function () {
            $("#container").animate({ scrollTop: $("#container").position().top - 40 }, 500);
            //$("#container").position().top - 40.scrollTop();
        });

        $("#down").click(function () {
            $("#container").animate({ scrollTop: $("#container").position().top + 40 }, 500);
        });
   });
  • 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-24T18:05:05+00:00Added an answer on May 24, 2026 at 6:05 pm

    I’ve constructed a simple jsFiddle to show my (new) way. I think I succeeded rather well.

    The point is to have 2 divs outside the scrolling content, which are in this case position: absolute; for the sake of looks alone. which control the content but not scroll with it.

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

Sidebar

Related Questions

I'm trying to create a div with a fixed size that contains images only.
Trying to create a box that contains sentences (with spaces) and can have a
I'm trying to create a web form that contains checkboxes, among other input elements,
I'm trying to create a page that contains a grid and searching. The issue
I am trying create a WCF service that leverages the WPF MediaPlayer on the
Trying to create my first iPhone app that would play back audio. When I
Trying to create a small monitor application that displays current internet usage as percentage
I have a peculiar problem. I am loading a JSON file that contains the
I have a div which contains a series of span tags, each containing a
Trying to create a QtRuby application, I get the following error: /usr/lib64/ruby/site_ruby/1.8/Qt/qtruby4.rb:2144: [BUG] Segmentation

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.