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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:59:14+00:00 2026-05-14T23:59:14+00:00

I am trying to create a scrollable DIV using the following: <!DOCTYPE html PUBLIC

  • 0

I am trying to create a scrollable DIV using the following:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
        <title>Test</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <script type="text/javascript" src="lib/jquery/jquery-1.3.2.js"></script>

    <style type="text/css">
        div.container {
          overflow:hidden;
          width:200px;
          height:200px;
        }
        div.content {
          position:relative;
          top:0;
        }
    </style>

    <script type="text/javascript">
        $(function(){
          $(".container a.up").bind("click", function(){
            var topVal = $(this).parents(".container").find(".content").css("top");
            $(this).parents(".container").find(".content").css("top", topVal-10);
          });

          $(".container a.dn").bind("click", function(){
            var topVal = $(this).parents(".container").find(".content").css("top");
            $(this).parents(".container").find(".content").css("top", topVal+10);
          });
        });
    </script>

</head>

<body>
<div class="container">
  <p>
    <a href="#" class="up">Up</a> / 
    <a href="#" class="dn">Down</a>
  </p>
  <div class="content">
    <p>Hello World 1</p>
    <p>Hello World 2</p>
    <p>Hello World 3</p>
    <p>Hello World 4</p>
    <p>Hello World 5</p>
    <p>Hello World 6</p>
    <p>Hello World 7</p>
    <p>Hello World 8</p>
    <p>Hello World 9</p>
    <p>Hello World 10</p>
    <p>Hello World 10</p>
    <p>Hello World 11</p>
    <p>Hello World 12</p>
    <p>Hello World 13</p>
    <p>Hello World 14</p>
    <p>Hello World 15</p>
    <p>Hello World 16</p>
    <p>Hello World 17</p>
    <p>Hello World 18</p>
    <p>Hello World 19</p>
    <p>Hello World 20</p>
    <p>Hello World 21</p>
    <p>Hello World 22</p>
    <p>Hello World 23</p>
    <p>Hello World 24</p>
    <p>Hello World 25</p>
    <p>Hello World 26</p>
    <p>Hello World 27</p>
  </div>
</div>
</body>
</html>

I don’t know where I am messing up, but it simply refuses to work. Any suggestions?

EDIT: I have tried both overflow: auto and overflow: hidden

  • 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-14T23:59:15+00:00Added an answer on May 14, 2026 at 11:59 pm

    topVal is a string, like 100px. You would need to parseInt(topVal, 10) to read it before adding a number to it (and that’s assuming it was already set to a pixel value).

    Better to use scrollTop to change the vertical scrolling position instead of trying to mess with the CSS. Also remember to return false from your click handlers to stop the # link being followed. Or, better, don’t mark the buttons up as links, ‘cos they’re not links, they don’t go anywhere. Use a button or eg. span, styled as appropriate.

    Better still to just use a perfectly normal overflow: auto div and let the browser provide the scrollbar. This will typically be much more usable than having custom scroll-up/scroll-down buttons, which personally I always find infuriatingly unpleasant to use.

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

Sidebar

Ask A Question

Stats

  • Questions 414k
  • Answers 414k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If you are using a version of SQL Server that… May 15, 2026 at 8:35 am
  • Editorial Team
    Editorial Team added an answer There are two out of the box solution available. The… May 15, 2026 at 8:35 am
  • Editorial Team
    Editorial Team added an answer Select TOP 1 WITH TIES FirstName, Count(OrderID) FROM Employees e… May 15, 2026 at 8:35 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.