如何实现高级的Javascript内容滑块?
我是一名设计师,负责实现类似于以下模型的水平 JS 滑块(按向右和向左箭头按钮查看我的目标):
http://hovenftp.com/spinscroll/scroll1.html (可能需要一些时间来加载)
我已经做了很多谷歌搜索来找到一个可以调整以实现类似功能的库,但我没有运气。我的 JS 技能严重缺乏,所以我不知道从哪里开始构建它。我猜测涉及绝对定位和条件的东西可以处理蓝色选择器的移动,但专辑也需要左右滚动。
任何帮助或提示将不胜感激。
I'm a designer in charge of implementing a horizontal JS slider similar to the follow mockup (press the right and left arrow buttons to see what I'm aiming for):
http://hovenftp.com/spinscroll/scroll1.html
(it may take some time to load)
I've done a lot of Googling to find a library that I can tweak to achieve something similar, but I've had no luck. My JS skills are woefully lacking, so I'm not sure where to even get started on building it from scratch. I'm guessing something involving absolute positioning and conditionals could handle the movement of the blue selector, but the albums need to scroll left and right too.
Any help or tips would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
bxslider 怎么样?检查 示例 ->一次多张幻灯片
How about bxslider? Check Examples -> Multiple slides at once
那么html结构是这样的;
您的 javascript 会计算 div.img 并计算 div.slider 宽度。然后,您将始终检查活动的 div.img 是否在 div.viewport 内,如果不在,请设置 div.slider 的 left 或 margin-left 样式,以便其位于视口中。这就是我为我工作的新闻公司开发滑块的方式 (www.20min.ch)
well the html structure is like this;
your javascript would count the div.img and calculate the div.slider width. You would then always check to see if the active div.img is within the div.viewport, if not, set the div.slider's left or margin-left style, so that its in the viewport. Thats how I've developed the sliders for the newscompany I work for (www.20min.ch)
我喜欢使用 Cycle 来做这样的事情。轻量级、文档齐全且易于定制以满足您的需求。
I like using Cycle for stuff like this. Lightweight, well-documented and easy to customize to suit your needs.