【发布时间】:2013-01-07 17:38:14
【问题描述】:
我有一个固定的 div 大小宽度。我将其表示为 x
我有一个固定的 div 大小高度。
我想在 div 的任一侧添加按钮,允许用户向右导航,即向右移动 x 个像素,即在 div 中显示下一个条目。
谁能提出解决这个问题的方法?
这是我当前的 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>
这里是jsfiddle
所以我想在 div 的任一侧添加两个按钮,这两个按钮都向左或向右移动 x 像素,显然是向左按钮,例如上一条评论,右键向右,下一条评论。
所以在我创建的 html 中,我希望滚动条一次向左或向右移动 577 像素,具体取决于用户点击。
让我知道你们的想法!
【问题讨论】:
标签: jquery html css navigation scrollbar