jQuery:如何在单击缩略图时显示图像弹出窗口?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2063199/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
jQuery: How can I show an image popup onclick of the thumbnail?
提问by dexter
In my aspx page I have a thumbnail image <img>
. When the user clicks on that image I would like a popup to show that blocks out the rest of the UI with the larger (full) version of the image.
在我的 aspx 页面中,我有一个缩略图<img>
。当用户单击该图像时,我想要一个弹出窗口来显示该图像的较大(完整)版本挡住了 UI 的其余部分。
Are there any plugins that can do this?
有没有插件可以做到这一点?
回答by rahul
There are a lot of jQuery plugins available for this
有很多 jQuery 插件可用于此
Thickbox Examples
厚盒示例
For a single image
对于单个图像
- Create a link element ()
- Give the link a class attribute with a value of thickbox (class="thickbox")
- Provide a path in the href attribute to an image file (.jpg .jpeg .png .gif .bmp)
- 创建链接元素 ()
- 给链接一个类属性,值为thickbox (class="thickbox")
- 在 href 属性中提供图像文件的路径 (.jpg .jpeg .png .gif .bmp)
回答by fastsoft
I like prettyPhoto
我喜欢漂亮照片
prettyPhoto is a jQuery lightboxclone. Not only does it support images, it also support for videos, flash, YouTube, iframes and ajax. It's a full blown media lightbox
PrettyPhoto 是一个 jQuery灯箱克隆。它不仅支持图片,还支持视频、flash、YouTube、iframes 和 ajax。这是一个完整的媒体灯箱
回答by user9869932
回答by Morteza Ziyae
This is the most popular (9500 stars) and light weight (20KB minify, 7.5KB minify+gzip) popup gallery I think: Magnific-Popup
这是我认为最受欢迎(9500 颗星)和轻量级(20KB minify,7.5KB minify+gzip)的弹出库: Magnific-Popup
回答by Tran Tuan Anh
prettyPhoto is a jQuery lightbox clone. Not only does it support images, it also support for videos, flash, YouTube, iframes and ajax. It's a full blown media lightbox
PrettyPhoto 是一个 jQuery 灯箱克隆。它不仅支持图片,还支持视频、flash、YouTube、iframes 和 ajax。这是一个完整的媒体灯箱