什么是最好的 jQuery“单击缩略图并更改主图像”? 模块?
这是我所拥有的(全部动态生成,如果这有什么不同的话):
- 图像列表
- 每个图像的标题
- 每个图像的缩略图
页面应该加载一个全尺寸图像和所有缩略图。 当用户单击缩略图时,全尺寸图像会显示该新图像及其标题。 如果他们单击另一个缩略图,图片(和标题)会再次更改。
这不是很复杂。 几个月前我编写了一个解决方案,但我需要再做一次,我看着这个蹩脚的代码,并认为必须有一个更好的方法(并且知道 jQuery,其他人已经做到了,并且完成了)好吧)。
想法? 链接?
谢谢!
Here's what I have (all generated dynamically, if that makes a difference) :
- A list of images
- A caption for each image
- A thumbnail for each image
The page should load with one full-size image and all the thumbnails. When a user clicks a thumbnail, the full-size image shows that new image with its caption. If they click another thumbnail, the picture (and caption) change again.
It's not very complex. I hacked together a solution a few months ago, but I need to do it again and I'm looking at this crappy code and thinking that there has to be a better way (and knowing jQuery, someone else has already done it, and done it well).
Thoughts? Links?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
这里的大多数答案就像用大炮打苍蝇一样!!
这就是你所需要的.. 4 行代码。
看这里:gallery-in-4-lines
Most of the answers here are like shooting a fly with a canon !!
this is all you need .. 4 lines of code .
look here : gallery-in-4-lines
你尝试过灯箱吗? http://leandrovieira.com/projects/jquery/lightbox/
Have you tried Lightbox? http://leandrovieira.com/projects/jquery/lightbox/
这是一个看起来很漂亮的,用 jQuery 编写的: 照片滑块
这是另一个我喜欢的好一点:
画廊
Here's one that looks pretty nice and is written in jQuery: Photo Slider
And here is another which I like a bit better:
Galleria
基于 krembo99 他在此处链接的答案,我想分享我的解决方案当我的客户请求这样的功能时,我已经上传了数百张照片。 考虑到这一点,通过在提供的代码中添加一些额外的行,我能够获得适合我的参数的解决方案。
我也在处理较小的图像,所以我不需要创建小图像和大图像。 同一文件的大版本。
这是我的 HTML 的外观。
Building off of krembo99's answer he linked here, I wanted to share my solution as I had already uploaded hundreds of photos when my client had requested a feature like this. With that in mind, by adding a few extra lines to the provided code, I was able to get a solution that fit my parameters.
I was also working with smaller images as well, so I had no need to go through creating small & large versions of the same file.
Here's how my HTML looks.
http://bradblogging.com/jquery/9-jquery -slideshow-applications-you-cannot-miss/
包含 9 个不同的 jQuery 照片幻灯片的页面,可供使用
http://bradblogging.com/jquery/9-jquery-slideshow-applications-you-cannot-miss/
A page with 9 different photo slideshows in jQuery ready to use
查看我的画廊实施:埃塞克斯画廊的花园设计景观设计师
Check out my galleria implementation: Garden design Landscaper in Essex Gallery
很多这些脚本都已经过时了,对我来说不起作用,而且需要一组不同的缩略图图像。 我认真地寻找了一下,发现了一些非常轻的东西,它是纯 js,不需要 jquery。
https://jsfiddle.net/uo6js5v7/
A lot of these scripts are out of date and don't work for me plus require a set of different images for thumbnails. I had a serious hunt around and found something very light which is plain js, no need for jquery.
https://jsfiddle.net/uo6js5v7/
尝试 Galleriffic,它拥有您需要的一切。
Try Galleriffic, it has everything you need.
我对替换方法有疑问。 这无疑是动态执行此操作的最简单方法。
I had issues with the replace method. This is hands down the easiest way to do this dynamically.