scrollTo 和水平表
我正在尝试制作一个水平滚动的作品集网站。我希望用户能够使用下一个/上一个按钮单击图像,并像平常一样使用鼠标和滚动条滚动。然而,我在使用 jquery 实现这个时遇到了麻烦。
使用该表是因为这是水平网站的最佳实践。我希望使用scrollTo()插件来允许表格根据单击的按钮向前或向后滚动。
最终产品类似于 this,尽管我尝试使用此网站上的代码 一点运气都没有!
我不知道如何做到这一点。
我的 HTML 如下:
<div id="content">
<div id="contentRight">
<ul id="direction">
<li id="next"><a class="forward">Next</a></li>
<li id="prev"><a class="back">Previous</a></li>
</ul>
<table id="work">
<tr>
<td id="horseOneImage" class="mainImage"><img src="media/images/horse.jpg" alt="" /></td>
<td id="horseTwoImage" class="mainImage"><img src="media/images/horse.jpg" alt="" /></td>
<td id="horseThreeImage" class="mainImage"><img src="media/images/horse.jpg" alt="" /></td>
<td id="horseFourImage" class="mainImage"><img src="media/images/horse.jpg" alt="" /></td>
<td id="horseFiveImage" class="mainImage"><img src="media/images/horse.jpg" alt="" /></td>
<td id="horseSixImage" class="mainImage"><img src="media/images/horse.jpg" alt="" /></td>
<td id="horseSevenImage" class="mainImage"><img src="media/images/horse.jpg" alt="" /></td>
<td id="horseEightImage" class="mainImage"><img src="media/images/horse.jpg" alt="" /></td>
</tr>
</table>
</div>
</div>
我没有当前的 jQuery 可以添加,因为我尝试过的任何东西都一团糟。
任何帮助都会很棒!
I am attempting to make a horizontal scrolling portfolio site. I want to users to be able to click through the images using a next/previous button as well as scrolling as per usual with the mouse and scroll bars. I am, however, having trouble implementing this using jquery.
The table is used as this is best practice in horizontal websites. I wish to use the scrollTo() plugin to allow the table to scroll forwards or backwards depending on which button is clicked.
The end product would resemble this, although I have tried to utilise the code on this site with NO luck at all!
I am lost on how to do this.
My HTML is as follows:
<div id="content">
<div id="contentRight">
<ul id="direction">
<li id="next"><a class="forward">Next</a></li>
<li id="prev"><a class="back">Previous</a></li>
</ul>
<table id="work">
<tr>
<td id="horseOneImage" class="mainImage"><img src="media/images/horse.jpg" alt="" /></td>
<td id="horseTwoImage" class="mainImage"><img src="media/images/horse.jpg" alt="" /></td>
<td id="horseThreeImage" class="mainImage"><img src="media/images/horse.jpg" alt="" /></td>
<td id="horseFourImage" class="mainImage"><img src="media/images/horse.jpg" alt="" /></td>
<td id="horseFiveImage" class="mainImage"><img src="media/images/horse.jpg" alt="" /></td>
<td id="horseSixImage" class="mainImage"><img src="media/images/horse.jpg" alt="" /></td>
<td id="horseSevenImage" class="mainImage"><img src="media/images/horse.jpg" alt="" /></td>
<td id="horseEightImage" class="mainImage"><img src="media/images/horse.jpg" alt="" /></td>
</tr>
</table>
</div>
</div>
I have no current jQuery to add as anything I have tried is just a mess.
Any help would be great!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
HTML
javascript
这是演示
HTML
javascript
here's the Demo
这有帮助吗?
jQuery.ScrollTo / jQuery.SerialScroll 水平滚动
我不确定表格将是要走的路...
Does this help at all?
jQuery.ScrollTo / jQuery.SerialScroll Horizontal Scrolling
And I'm not sure tables would be the way to go...