I have a fixed width div. i will denote this as x
I have a fixed div size height.
I want to add buttons on either side of the div so that the user can move to the right, i.e. move x the number of pixels to the right, i.e. show next entry in 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> <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 jsfiddle
So, I want to add two buttons on either side of the div, both of which move x pixels to the left or right, obviously the left button on the left, for example. previous comment, right button on the right, next comment.
So, in the html created, I want the scroll bar to move left or right 577px at a time, depending on the user's click.
Let me know what you guys think!
source share