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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:20:32+00:00 2026-06-17T17:20:32+00:00

I have a fixed div size width. i’ll denote this as x I have

  • 0

I have a fixed div size width. i’ll denote this as x

I have a fixed div size height.

I want to add buttons to either side of the div allowing the user to navigate right i.e. moving x amount of pixels to the right, i.e. showing the next entry in the div.

Can anyone suggest a solution to this problem?

Here is my current html / css:

<div class="outer_container" style="overflow: scroll; overflow-y: hidden; width:577px; border-style:solid; border-width:5px; border-color:#578278;">
    <div class="inner_container" style="width: 10000px;">

<table>
    <tr>
        <td style=" width: 577px; ">
            <div style="text-align:left;  margin: 0px 10px 10px 10px; width:557px; ">
                <p>Add Comment to the Tesco Catalogue</p>
                <form class="comment_form" action="profile" method="post">
                    <textarea style="resize:none;" maxlength="250" rows="2" cols="65" placeholder="Enter your comment here..."></textarea>
                    <input type="submit" value="Submit"/>
                </form>
            </div>
        </td>
        <!-- do a for loop here to generate all other items -->
        <td style="width:577px;">
            <div style="text-align:left; padding: 5px 10px 5px 10px; margin: 0px 10px 10px 10px; width:567px; border-style:solid; border-width:1px; border-color:#578278;">
                <p class="comment_username"> User said at such a time</p>
                <p class="comment_comment"> Comment ......</p>
            </div>
        </td>
        <td style="width:577px;">
            <div style="text-align:left; padding: 5px 10px 5px 10px; margin: 0px 10px 10px 10px; width:567px; border-style:solid; border-width:1px; border-color:#578278;">
                <p class="comment_username"> User said at such a time</p>
                <p class="comment_comment"> Comment ......</p>
            </div>
        </td>
    </tr>
</table>
</div>
</div>

Here is the jsfiddle

So I want to add two buttons one either side of the div, both of which move x pixels, left or right, obviously left button left e.g. previous comment , right button right, next comment.

So in the html i’ve created I want the scroll bar to either move left or right 577px at a time, depending on the user click.

Let me know what you think guys!

  • 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-17T17:20:34+00:00Added an answer on June 17, 2026 at 5:20 pm

    You can use scrollLeft() to retrieve the current scroll position. Then use jQuery’s animate function to smoothly scroll the container left/right. I added two buttons with ids of left/right for this. The only difference between the functions is that one adds a distance of 200 whereas the other subtracts 200. Substitute 200 for whatever scroll amount you want. For bonus points you could detect the left position of the next comments section relative to the div container and calculate the two hundred value on the fly.

    http://jsfiddle.net/EB4UC/70/

    $('#left').click(function () {
        var leftPos = $('div.outer_container').scrollLeft();
        console.log(leftPos);    
        $("div.outer_container").animate({
            scrollLeft: leftPos - 200
        }, 800);
    });
    
    $('#right').click(function () {
        var leftPos = $('div.outer_container').scrollLeft();
        console.log(leftPos); 
        $("div.outer_container").animate({
            scrollLeft: leftPos + 200
        }, 800);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider that we have a DIV with fixed height. Without a defined width ,
I have a div element with fixed height and width and overflow:hidden, and I
I'm trying to create a div which will have fixed width and flexible height
I have a div and its width and height depend of browser window size.
I have a fixed width and height DIV, and I need to put text
I have a div with fixed height and width and inside I have text
I have a fixed position div with a fixed height/width. The div is positioned
I have a div on page with a fixed width of 1200px. It's this
I have a div with a fixed size of 100px. scrollWidth and scrollHeight works
I have a problem with IE. I have a fixed div like this: #fixed

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.